mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Cleanup net integration test case for network modules (#34684)
* Remove platform agnostic net_* test cases. * Add minimal platform agnostic test cases to individual platform-specific test cases
This commit is contained in:
parent
2df6735dcf
commit
c53dcd1982
181 changed files with 1630 additions and 6246 deletions
|
@ -1,106 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: platform_agnostic
|
|
||||||
gather_facts: no
|
|
||||||
connection: local
|
|
||||||
|
|
||||||
vars:
|
|
||||||
limit_to: "*"
|
|
||||||
debug: false
|
|
||||||
|
|
||||||
|
|
||||||
# Run the tests within blocks allows the next module to be tested if the previous one fails.
|
|
||||||
# This is done to allow https://github.com/ansible/dci-partner-ansible/ to run the full set of tests.
|
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- set_fact:
|
|
||||||
test_failed: false
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_system
|
|
||||||
when: "limit_to in ['*', 'net_system']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_banner
|
|
||||||
when: "limit_to in ['*', 'net_banner']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_user
|
|
||||||
when: "limit_to in ['*', 'net_user']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_vlan
|
|
||||||
when: "limit_to in ['*', 'net_vlan']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_vrf
|
|
||||||
when: "limit_to in ['*', 'net_vrf']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_interface
|
|
||||||
when: "limit_to in ['*', 'net_interface']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_static_route
|
|
||||||
when: "limit_to in ['*', 'net_static_route']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_logging
|
|
||||||
when: "limit_to in ['*', 'net_logging']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_linkagg
|
|
||||||
when: "limit_to in ['*', 'net_linkagg']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_lldp
|
|
||||||
when: "limit_to in ['*', 'net_lldp']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_lldp_interface
|
|
||||||
when: "limit_to in ['*', 'net_lldp_interface']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- include_role:
|
|
||||||
name: net_l3_interface
|
|
||||||
when: "limit_to in ['*', 'net_l3_interface']"
|
|
||||||
rescue:
|
|
||||||
- set_fact: test_failed=true
|
|
||||||
|
|
||||||
###########
|
|
||||||
- name: Has any previous test failed?
|
|
||||||
fail:
|
|
||||||
msg: "One or more tests failed, check log for details"
|
|
||||||
when: test_failed
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_banner.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Remove previous motd banner (setup)
|
||||||
|
eos_config:
|
||||||
|
lines: no banner motd
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
|
- name: create motd
|
||||||
|
net_banner:
|
||||||
|
banner: motd
|
||||||
|
text: this is my motd banner configure by net_banner
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'this is my motd banner configure by net_banner' in result.commands"
|
||||||
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
||||||
|
- "'ansible_1' in result.session_name"
|
||||||
|
|
||||||
|
- name: Remove previous motd banner (teardown)
|
||||||
|
eos_config:
|
||||||
|
lines: no banner motd
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_banner.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,56 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Set test interface
|
||||||
|
set_fact:
|
||||||
|
test_interface_1: ethernet1
|
||||||
|
|
||||||
|
- name: Configure interface (setup)
|
||||||
|
net_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
description: test-interface-1
|
||||||
|
mtu: 1800
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Configure interface description using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
description: test-interface-initial
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
||||||
|
- '"description test-interface-initial" in result.commands'
|
||||||
|
|
||||||
|
- name: Confgure interface parameters
|
||||||
|
net_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
description: test-interface
|
||||||
|
mtu: 2000
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
||||||
|
- '"description test-interface" in result.commands'
|
||||||
|
- '"mtu 2000" in result.commands'
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_l3_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Set test interface
|
||||||
|
set_fact:
|
||||||
|
test_interface_1: ethernet1
|
||||||
|
|
||||||
|
- name: Delete interface ipv4 and ipv6 address(setup)
|
||||||
|
net_l3_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Configure interface ipv4 address using platform agnostic module
|
||||||
|
net_l3_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
ipv4: 192.108.0.1/24
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface {{ test_interface_1 }}" in result.commands'
|
||||||
|
- '"ip address 192.108.0.1/24" in result.commands'
|
||||||
|
|
||||||
|
- name: Delete interface ipv4 and ipv6 address(teardown)
|
||||||
|
net_l3_interface:
|
||||||
|
name: "{{ test_interface_1 }}"
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_l3_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_logging.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Delete/disable host logging- setup
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Set up host logging using platform agnostic module
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"logging host 172.16.0.1" in result.commands'
|
||||||
|
|
||||||
|
- name: Delete/disable host logging- teardown
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_logging.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_static_route.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove config used in test
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no ip route 192.168.3.0/24 192.168.0.1
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: configure static route using platform agnostic module
|
||||||
|
net_static_route:
|
||||||
|
address: 192.168.3.0/24
|
||||||
|
next_hop: 192.168.0.1
|
||||||
|
admin_distance: 2
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands"
|
||||||
|
|
||||||
|
- name: teardown - remove config used in test
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no ip route 192.168.3.0/24 192.168.0.1
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_static_route.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_system.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: configure domain_list using platform agnostic module
|
||||||
|
net_system:
|
||||||
|
domain_list:
|
||||||
|
- ansible.com
|
||||||
|
- redhat.com
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- "'ip domain-list ansible.com' in result.commands"
|
||||||
|
- "'ip domain-list redhat.com' in result.commands"
|
||||||
|
|
||||||
|
- name: teardown
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_system.yaml on connection={{ ansible_connection }}"
|
41
test/integration/targets/eos_user/tests/cli/net_user.yaml
Normal file
41
test/integration/targets/eos_user/tests/cli/net_user.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_user.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Set Up
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no username ansibletest1
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Create user with role using platform agnostic module
|
||||||
|
net_user:
|
||||||
|
name: ansibletest1
|
||||||
|
privilege: 15
|
||||||
|
role: network-operator
|
||||||
|
state: present
|
||||||
|
configured_password: test1
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"username" in result.commands[0]'
|
||||||
|
- '"secret" in result.commands[0]'
|
||||||
|
- '"role network-operator" in result.commands[1]'
|
||||||
|
- '"privilege 15" in result.commands[2]'
|
||||||
|
|
||||||
|
- name: Teardown
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no username ansibletest1
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_user.yaml on connection={{ ansible_connection }}"
|
41
test/integration/targets/eos_vlan/tests/cli/net_vlan.yaml
Normal file
41
test/integration/targets/eos_vlan/tests/cli/net_vlan.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_vlan.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove vlans used in test
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no vlan 4000
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Create vlan using platform agnostic vlan module
|
||||||
|
net_vlan:
|
||||||
|
vlan_id: 4000
|
||||||
|
name: vlan-4000
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'vlan 4000' in result.commands"
|
||||||
|
- "'name vlan-4000' in result.commands"
|
||||||
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
||||||
|
- "'ansible_1' in result.session_name"
|
||||||
|
|
||||||
|
- name: setup - remove vlans used in test
|
||||||
|
eos_config:
|
||||||
|
lines:
|
||||||
|
- no vlan 4000
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_vlan.yaml on connection={{ ansible_connection }}"
|
41
test/integration/targets/eos_vrf/tests/cli/net_vrf.yaml
Normal file
41
test/integration/targets/eos_vrf/tests/cli/net_vrf.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START eos cli/net_vrf.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove vrf
|
||||||
|
net_vrf:
|
||||||
|
name: test
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Create vrf using platform agnostic vrf module
|
||||||
|
net_vrf:
|
||||||
|
name: test
|
||||||
|
rd: 1:200
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'vrf definition test' in result.commands"
|
||||||
|
- "'rd 1:200' in result.commands"
|
||||||
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
||||||
|
- "'ansible_1' in result.session_name"
|
||||||
|
|
||||||
|
- name: teardown - remove vrf
|
||||||
|
net_vrf:
|
||||||
|
name: test
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- debug: msg="END eos cli/net_vrf.yaml on connection={{ ansible_connection }}"
|
32
test/integration/targets/ios_banner/tests/cli/net_banner.yml
Normal file
32
test/integration/targets/ios_banner/tests/cli/net_banner.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START ios cli/net_banner.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove login
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- name: Set login
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
text: this is my login banner confgiured by net_banner
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'banner login @\nthis is my login banner confgiured by net_banner\n@' in result.commands"
|
||||||
|
|
||||||
|
- name: teardown - remove login
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- debug: msg="END ios cli/net_banner.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,80 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START ios cli/net_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- 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: "{{ test_interface }}"
|
||||||
|
description: test-interface-1
|
||||||
|
speed: 1000
|
||||||
|
mtu: 1800
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Configure interface using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: "{{ test_interface }}"
|
||||||
|
description: test-interface-initial
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface {{ test_interface }}" in result.commands'
|
||||||
|
- '"description test-interface-initial" in result.commands'
|
||||||
|
|
||||||
|
- name: Confgure interface parameters using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: "{{ test_interface }}"
|
||||||
|
description: test-interface
|
||||||
|
mtu: 2000
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface {{ test_interface }}" in result.commands'
|
||||||
|
- '"description test-interface" in result.commands'
|
||||||
|
- '"mtu 2000" in result.commands'
|
||||||
|
|
||||||
|
- debug: msg="START ios cli/net_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START ios cli/net_logging.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Remove host logging - setup
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- name: Set up host logging using platform agnostic module
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
facility: local7
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"logging host 172.16.0.1" in result.commands'
|
||||||
|
- '"logging facility local7" in result.commands'
|
||||||
|
|
||||||
|
- name: Remove host logging - teardown
|
||||||
|
net_logging:
|
||||||
|
dest: host
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- debug: msg="END ios cli/net_logging.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START ios cli/net_static_route.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: delete static route - setup
|
||||||
|
net_static_route:
|
||||||
|
prefix: 172.16.31.0
|
||||||
|
mask: 255.255.255.0
|
||||||
|
next_hop: 10.0.0.8
|
||||||
|
admin_distance: 2
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: create static route using platform agnostic module
|
||||||
|
net_static_route:
|
||||||
|
prefix: 172.16.31.0
|
||||||
|
mask: 255.255.255.0
|
||||||
|
next_hop: 10.0.0.8
|
||||||
|
state: present
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- 'result.commands == ["ip route 172.16.31.0 255.255.255.0 10.0.0.8 1"]'
|
||||||
|
|
||||||
|
- name: delete static route - teardown
|
||||||
|
net_static_route:
|
||||||
|
prefix: 172.16.31.0
|
||||||
|
mask: 255.255.255.0
|
||||||
|
next_hop: 10.0.0.8
|
||||||
|
admin_distance: 2
|
||||||
|
state: absent
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: msg="END ios cli/net_static_route.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START ios cli/net_system.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup
|
||||||
|
ios_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- name: configure domain_search using platform agnostic module
|
||||||
|
net_system:
|
||||||
|
domain_search:
|
||||||
|
- ansible.com
|
||||||
|
- redhat.com
|
||||||
|
authorize: yes
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- "'ip domain list ansible.com' in result.commands"
|
||||||
|
- "'ip domain list redhat.com' in result.commands"
|
||||||
|
|
||||||
|
- name: teardown
|
||||||
|
ios_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
authorize: yes
|
||||||
|
|
||||||
|
- debug: msg="END ios cli/net_system.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,54 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START iosxr cli/net_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Setup interface
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/2
|
||||||
|
state: absent
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
|
||||||
|
- name: Confgure interface using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/2
|
||||||
|
description: test-interface-initial
|
||||||
|
state: present
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in result.commands'
|
||||||
|
|
||||||
|
- name: Confgure interface parameters using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/2
|
||||||
|
description: test-interface
|
||||||
|
speed: 100
|
||||||
|
duplex: half
|
||||||
|
mtu: 512
|
||||||
|
state: present
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands'
|
||||||
|
- '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands'
|
||||||
|
- '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands'
|
||||||
|
- '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands'
|
||||||
|
|
||||||
|
- name: Teardown interface
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/2
|
||||||
|
state: absent
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: msg="END iosxr cli/net_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,54 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START iosxr netconf/net_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Enable Netconf service
|
||||||
|
iosxr_netconf:
|
||||||
|
netconf_port: 830
|
||||||
|
netconf_vrf: 'default'
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Setup interface
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
|
||||||
|
- name: Confgure interface using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/1
|
||||||
|
description: test-interface-initial
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"GigabitEthernet0/0/0/1" in result.xml[0]'
|
||||||
|
|
||||||
|
- name: Confgure interface parameters using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: GigabitEthernet0/0/0/1
|
||||||
|
description: test-interface
|
||||||
|
speed: 100
|
||||||
|
duplex: half
|
||||||
|
mtu: 512
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"GigabitEthernet0/0/0/1" in result.xml[0]'
|
||||||
|
- '"test-interface" in result.xml[0]'
|
||||||
|
- '"100" in result.xml[0]'
|
||||||
|
- '"512" in result.xml[0]'
|
||||||
|
|
||||||
|
- debug: msg="END iosxr netconf/net_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START iosxr cli/net_logging.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: Remove host logging - setup
|
||||||
|
net_logging:
|
||||||
|
dest: hostnameprefix
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
- name: Set up host logging using platform agnostic module
|
||||||
|
net_logging:
|
||||||
|
dest: hostnameprefix
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: present
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"logging hostnameprefix 172.16.0.1" in result.commands'
|
||||||
|
|
||||||
|
- name: Remove host logging - teardown
|
||||||
|
net_logging:
|
||||||
|
dest: hostnameprefix
|
||||||
|
name: 172.16.0.1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
- debug: msg="END iosxr cli/net_logging.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START iosxr cli/net_system.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup
|
||||||
|
iosxr_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
- name: configure domain_search using platform agnostic module
|
||||||
|
net_system:
|
||||||
|
domain_search:
|
||||||
|
- ansible.com
|
||||||
|
- redhat.com
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- "'domain list ansible.com' in result.commands"
|
||||||
|
- "'domain list redhat.com' in result.commands"
|
||||||
|
|
||||||
|
- name: setup
|
||||||
|
iosxr_config:
|
||||||
|
lines:
|
||||||
|
- no ip domain-list ansible.com
|
||||||
|
- no ip domain-list redhat.com
|
||||||
|
match: none
|
||||||
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
|
- debug: msg="END iosxr cli/net_system.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos net_banner netconf/net_banner.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
- name: setup - remove login banner
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Create login banner
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
text: this is my login banner configured by net_banner
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<message>this is my login banner configured by net_banner</message>' in config.xml"
|
||||||
|
|
||||||
|
- name: teardown - remove login banner
|
||||||
|
net_banner:
|
||||||
|
banner: login
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos net_banner netconf/net_banner.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful
|
||||||
|
|
||||||
|
- name: setup remove interface
|
||||||
|
net_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
description: test-interface
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Create interface using platform agnostic module
|
||||||
|
net_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
description: test-interface
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||||
|
- "'<description>test-interface</description>' in config.xml"
|
||||||
|
|
||||||
|
- name: teardown remove interface
|
||||||
|
net_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
description: test-interface
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,46 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_l3_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove interface address
|
||||||
|
net_l3_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
ipv4: 1.1.1.1
|
||||||
|
ipv6: fd5d:12c9:2201:1::1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Configure interface address using platform agnostic module
|
||||||
|
net_l3_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
ipv4: 1.1.1.1
|
||||||
|
ipv6: fd5d:12c9:2201:1::1
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<name>1.1.1.1/32</name>' in config.xml"
|
||||||
|
- "'<name>fd5d:12c9:2201:1::1/128</name>' in config.xml"
|
||||||
|
- result.diff.prepared is search("\+ *address 1.1.1.1/32")
|
||||||
|
- result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128")
|
||||||
|
|
||||||
|
- name: teardown - remove interface address
|
||||||
|
net_l3_interface:
|
||||||
|
name: ge-0/0/1
|
||||||
|
ipv4: 1.1.1.1
|
||||||
|
ipv6: fd5d:12c9:2201:1::1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_l3_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_linkagg.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove linkagg
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
members:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/7
|
||||||
|
mode: active
|
||||||
|
device_count: 4
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: configure linkagg using platform agnostic module
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
members:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/7
|
||||||
|
mode: active
|
||||||
|
device_count: 4
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<name>ae0</name>' in config.xml"
|
||||||
|
- "'<device-count>4</device-count>' in config.xml"
|
||||||
|
- "'<bundle>ae0</bundle>' in config.xml"
|
||||||
|
- "'<active/>' in config.xml"
|
||||||
|
|
||||||
|
- name: teardown - remove linkagg
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
members:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/7
|
||||||
|
mode: active
|
||||||
|
device_count: 4
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_linkagg.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_lldp.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - Disable lldp - setup
|
||||||
|
net_lldp:
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Enable lldp using platform agnostic module
|
||||||
|
net_lldp:
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
|
||||||
|
- name: setup - Disable lldp - teardown
|
||||||
|
net_lldp:
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="START junos netconf/net_lldp.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_lldp_interface.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - Remove lldp interface configuration
|
||||||
|
net_lldp_interface:
|
||||||
|
name: ge-0/0/5
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: lldp interface configuration using platform agnostic module
|
||||||
|
net_lldp_interface:
|
||||||
|
name: ge-0/0/5
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared is search("\+ *interface ge-0/0/5")
|
||||||
|
|
||||||
|
- name: teardown - Remove lldp interface configuration
|
||||||
|
net_lldp_interface:
|
||||||
|
name: ge-0/0/5
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_lldp_interface.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,48 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_logging.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove file logging
|
||||||
|
net_logging:
|
||||||
|
dest: file
|
||||||
|
name: test
|
||||||
|
facility: pfe
|
||||||
|
level: error
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Create file logging using platform agnostic module
|
||||||
|
net_logging:
|
||||||
|
dest: file
|
||||||
|
name: test_file
|
||||||
|
facility: pfe
|
||||||
|
level: error
|
||||||
|
state: present
|
||||||
|
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: teardown - remove file logging
|
||||||
|
net_logging:
|
||||||
|
dest: file
|
||||||
|
name: test
|
||||||
|
facility: pfe
|
||||||
|
level: error
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_logging.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,46 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_static_route.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove static route
|
||||||
|
net_static_route:
|
||||||
|
address: 1.1.1.0/24
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Confgiure static route using platform agnostic module
|
||||||
|
net_static_route:
|
||||||
|
address: 1.1.1.0/24
|
||||||
|
next_hop: 3.3.3.3
|
||||||
|
preference: 10
|
||||||
|
qualified_next_hop: 5.5.5.5
|
||||||
|
qualified_preference: 30
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<name>1.1.1.0/24</name>' in config.xml"
|
||||||
|
- "'<next-hop>3.3.3.3</next-hop>' in config.xml"
|
||||||
|
- "'<qualified-next-hop>' in config.xml"
|
||||||
|
- "'<name>5.5.5.5</name>' in config.xml"
|
||||||
|
- "'<preference>30</preference>' in config.xml"
|
||||||
|
- "'<metric-value>10</metric-value>' in config.xml"
|
||||||
|
|
||||||
|
- name: setup - remove static route
|
||||||
|
net_static_route:
|
||||||
|
address: 1.1.1.0/24
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_static_route.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_system.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove hostname
|
||||||
|
net_system:
|
||||||
|
hostname: vsrx01
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Set hostname using platform agnostic module
|
||||||
|
net_system:
|
||||||
|
hostname: vsrx01
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<host-name>vsrx01</host-name>' in config.xml"
|
||||||
|
|
||||||
|
- name: teardown - remove hostname
|
||||||
|
net_system:
|
||||||
|
hostname: vsrx01
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_system.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_user.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove user
|
||||||
|
net_user:
|
||||||
|
name: test_user
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Create user with platform agnostic module
|
||||||
|
net_user:
|
||||||
|
name: test_user
|
||||||
|
state: present
|
||||||
|
full_name: test_user
|
||||||
|
role: operator
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<name>test_user</name>' in config.xml"
|
||||||
|
- "'<full-name>test_user</full-name>' in config.xml"
|
||||||
|
- "'<class>operator</class>' in config.xml"
|
||||||
|
|
||||||
|
- name: teardown - remove user
|
||||||
|
net_user:
|
||||||
|
name: test_user
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_user.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_vlan.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove vlan
|
||||||
|
net_vlan:
|
||||||
|
name: test-vlan
|
||||||
|
description: test vlan
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Create vlan using platform agnostic vlan module
|
||||||
|
net_vlan:
|
||||||
|
vlan_id: 100
|
||||||
|
name: test-vlan
|
||||||
|
state: present
|
||||||
|
description: test vlan
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: teardown - remove vlan
|
||||||
|
net_vlan:
|
||||||
|
name: test-vlan
|
||||||
|
description: test vlan
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="END junos netconf/net_vlan.yaml on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,43 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
|
# Add minimal testcase to check args are passed correctly to
|
||||||
|
# implementation module and module run is successful.
|
||||||
|
|
||||||
|
- name: setup - remove vrf
|
||||||
|
net_vrf:
|
||||||
|
name: test-1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- name: Configure vrf and its parameter using platform agnostic vrf module
|
||||||
|
net_vrf:
|
||||||
|
name: test-1
|
||||||
|
description: test-vrf-1
|
||||||
|
interfaces:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/5
|
||||||
|
rd: 3.3.3.3:10
|
||||||
|
target: target:65513:111
|
||||||
|
state: present
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared is search("\+ *test-1")
|
||||||
|
- result.diff.prepared is search("\+ *description test-vrf-1")
|
||||||
|
- result.diff.prepared is search("\+ *instance-type vrf")
|
||||||
|
- result.diff.prepared is search("\+ *interface ge-0/0/5.0")
|
||||||
|
- result.diff.prepared is search("\+ *interface ge-0/0/6.0")
|
||||||
|
- result.diff.prepared is search("\+ *route-distinguisher 3.3.3.3:10")
|
||||||
|
- result.diff.prepared is search("\+ *vrf-target target:65513:111")
|
||||||
|
|
||||||
|
- name: teardown - remove vrf
|
||||||
|
net_vrf:
|
||||||
|
name: test-1
|
||||||
|
state: absent
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
|
||||||
|
- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection }}"
|
|
@ -1 +0,0 @@
|
||||||
network/ci
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all cli test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/cli"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/ios/basic-login.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'ios'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/eos/basic-login.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/ios/basic-motd.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'ios'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/eos/basic-motd.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/ios/basic-no-login.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'ios'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/eos/basic-no-login.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
|
|
|
@ -1,55 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: setup - remove login
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- name: Set login
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
this is my login banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'this is my login banner' in result.commands"
|
|
||||||
- "'that has a multiline' in result.commands"
|
|
||||||
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
||||||
- "'ansible_1' in result.session_name"
|
|
||||||
|
|
||||||
- name: Set login again (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
this is my login banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
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:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,92 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: setup - remove motd
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
|
|
||||||
- name: Set motd
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
provider: "{{ cli }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'this is my motd banner' in result.commands"
|
|
||||||
- "'that has a multiline' in result.commands"
|
|
||||||
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
||||||
- "'ansible_1' in result.session_name"
|
|
||||||
|
|
||||||
- name: Set motd again (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
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"
|
|
||||||
|
|
||||||
- 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:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,48 +0,0 @@
|
||||||
---
|
|
||||||
- name: Setup
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
Junk login banner
|
|
||||||
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:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'no banner login' in result.commands" # does this break due to "contains?"
|
|
||||||
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
||||||
- "'ansible_1' in result.session_name"
|
|
||||||
|
|
||||||
- name: remove login (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
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:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,47 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- name: setup - remove login
|
|
||||||
ios_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
|
|
||||||
- name: Set login
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
this is my login banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner login @\nthis is my login banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: Set login again (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
this is my login banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
- "result.commands | length == 0"
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME add in tests for everything defined in docs
|
|
||||||
# FIXME Test state:absent + test:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,46 +0,0 @@
|
||||||
---
|
|
||||||
- name: setup - remove motd
|
|
||||||
ios_banner:
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
|
|
||||||
- name: Set motd
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner motd @\nthis is my motd banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: Set motd again (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
- "result.commands | length == 0"
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME add in tests for everything defined in docs
|
|
||||||
# FIXME Test state:absent + test:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,41 +0,0 @@
|
||||||
---
|
|
||||||
- name: Setup
|
|
||||||
ios_banner:
|
|
||||||
banner: login
|
|
||||||
text: |
|
|
||||||
Junk login banner
|
|
||||||
over multiple lines
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
|
|
||||||
- name: remove login
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
msg: "{{ result }}"
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'no banner login' in result.commands" # does this break due to "contains?"
|
|
||||||
|
|
||||||
- name: remove login (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
- "result.commands | length == 0"
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME add in tests for everything defined in docs
|
|
||||||
# FIXME Test state:absent + test:
|
|
||||||
# FIXME Without powers ensure "privileged mode required"
|
|
|
@ -1,112 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_banner junos/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup - remove login banner
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: Create login banner
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: this is my login banner
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<message>this is my login banner</message>' in config.xml"
|
|
||||||
|
|
||||||
- name: Create login banner (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
text: this is my login banner
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: delete login banner
|
|
||||||
net_banner:
|
|
||||||
banner: login
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<message>this is my login banner</message>' not in config.xml"
|
|
||||||
|
|
||||||
- name: setup - remove motd banner
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: Create motd banner
|
|
||||||
junos_banner:
|
|
||||||
banner: motd
|
|
||||||
text: this is my motd banner
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
|
||||||
|
|
||||||
- name: Create motd banner (idempotent)
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
text: this is my motd banner
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: delete motd banner
|
|
||||||
net_banner:
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<announcement>this is my motd banner</announcement>' not in config.xml"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all cli test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/cli"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START cli/contains.yaml"
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/eos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/vyos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/iosxr/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'iosxr'
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/ios/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'ios'
|
|
||||||
|
|
||||||
- debug: msg="END cli/contains.yaml"
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_interface eos/basic.yaml"
|
|
|
@ -1,261 +0,0 @@
|
||||||
---
|
|
||||||
- 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: "{{ test_interface }}"
|
|
||||||
description: test-interface-1
|
|
||||||
speed: 1000
|
|
||||||
mtu: 1800
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Configure interface
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
description: test-interface-initial
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"description test-interface-initial" in result.commands'
|
|
||||||
|
|
||||||
- name: Confgure interface (idempotent)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
description: test-interface-initial
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Confgure interface parameters
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
description: test-interface
|
|
||||||
mtu: 2000
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"description test-interface" in result.commands'
|
|
||||||
- '"mtu 2000" in result.commands'
|
|
||||||
|
|
||||||
- name: Change interface parameters
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
description: test-interface-1
|
|
||||||
mtu: 1800
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"description test-interface-1" in result.commands'
|
|
||||||
- '"mtu 1800" in result.commands'
|
|
||||||
|
|
||||||
- name: Disable interface
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
enabled: False
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
enabled: True
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"no shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Confgure second interface (setup)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface2 }}"
|
|
||||||
description: test-interface-initial
|
|
||||||
speed: 1000
|
|
||||||
mtu: 1800
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Add interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: "{{ test_interface }}", mtu: 2000, description: test-interface-1 }
|
|
||||||
- { name: "{{ test_interface2 }}", mtu: 2000, description: test-interface-2 }
|
|
||||||
speed: 1000
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"mtu 2000" in result.commands'
|
|
||||||
- '"interface {{ test_interface2 }}" in result.commands'
|
|
||||||
- '"description test-interface-2" in result.commands'
|
|
||||||
- '"mtu 2000" in result.commands'
|
|
||||||
|
|
||||||
- name: Add interface aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: "{{ test_interface }}", mtu: 2000, description: test-interface-1 }
|
|
||||||
- { name: "{{ test_interface2 }}", mtu: 2000, description: test-interface-2 }
|
|
||||||
speed: 1000
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: "{{ test_interface }}" }
|
|
||||||
- { name: "{{ test_interface2 }}" }
|
|
||||||
enabled: False
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"shutdown" in result.commands'
|
|
||||||
- '"interface {{ test_interface2 }}" in result.commands'
|
|
||||||
- '"shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: "{{ test_interface }}" }
|
|
||||||
- { name: "{{ test_interface2 }}" }
|
|
||||||
enabled: True
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface {{ test_interface }}" in result.commands'
|
|
||||||
- '"no shutdown" in result.commands'
|
|
||||||
- '"interface {{ test_interface2 }}" in result.commands'
|
|
||||||
- '"no shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: loopback interface setup
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: Loopback9
|
|
||||||
- name: Loopback10
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
|
|
||||||
- name: Create loopback interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: Loopback9
|
|
||||||
- name: Loopback10
|
|
||||||
state: present
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface Loopback9" in result.commands'
|
|
||||||
- '"interface Loopback10" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete loopback interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: Loopback9
|
|
||||||
- name: Loopback10
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"no interface Loopback9" in result.commands'
|
|
||||||
- '"no interface Loopback10" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete loopback interface aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: Loopback9
|
|
||||||
- name: Loopback10
|
|
||||||
state: absent
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- debug: msg="END net_interface cli/basic.yaml"
|
|
|
@ -1,161 +0,0 @@
|
||||||
---
|
|
||||||
- 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: "{{ test_interface }}"
|
|
||||||
state: up
|
|
||||||
tx_rate: ge(0)
|
|
||||||
rx_rate: le(0)
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Check intent arguments (failed condition)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
state: down
|
|
||||||
tx_rate: gt(0)
|
|
||||||
rx_rate: lt(0)
|
|
||||||
authorize: yes
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(down)' in result.failed_conditions"
|
|
||||||
- "'tx_rate gt(0)' in result.failed_conditions"
|
|
||||||
- "'rx_rate lt(0)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Config + intent
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
enabled: False
|
|
||||||
state: down
|
|
||||||
authorize: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Config + intent (fail)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ test_interface }}"
|
|
||||||
enabled: False
|
|
||||||
authorize: yes
|
|
||||||
state: up
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "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: "{{ test_interface }}"
|
|
||||||
enabled: True
|
|
||||||
state: up
|
|
||||||
authorize: yes
|
|
||||||
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"
|
|
|
@ -1,242 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_interface iosxr/basic.yaml"
|
|
||||||
|
|
||||||
- name: Setup interface
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
|
|
||||||
- name: Confgure interface
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
description: test-interface-initial
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in result.commands'
|
|
||||||
|
|
||||||
- name: Confgure interface (idempotent)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
description: test-interface-initial
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Confgure interface parameters
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
description: test-interface
|
|
||||||
speed: 100
|
|
||||||
duplex: half
|
|
||||||
mtu: 512
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands'
|
|
||||||
|
|
||||||
- name: Change interface parameters
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
description: test-interface-1
|
|
||||||
speed: 10
|
|
||||||
duplex: full
|
|
||||||
mtu: 256
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 description test-interface-1" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 speed 10" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 mtu 256" in result.commands'
|
|
||||||
|
|
||||||
- name: Change interface parameters (idempotent)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
description: test-interface-1
|
|
||||||
speed: 10
|
|
||||||
duplex: full
|
|
||||||
mtu: 256
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable interface
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
enabled: False
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/2
|
|
||||||
enabled: True
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Confgure second interface (setup)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/3
|
|
||||||
description: test-interface-initial
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 description test-interface-initial" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface aggregate (setup)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/3
|
|
||||||
- name: GigabitEthernet0/0/0/2
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Add interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 }
|
|
||||||
- { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 }
|
|
||||||
speed: 100
|
|
||||||
duplex: full
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 speed 100" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 description test-interface-1" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 duplex full" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 mtu 256" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 description test-interface-2" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 mtu 516" in result.commands'
|
|
||||||
|
|
||||||
|
|
||||||
- name: Add interface aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 }
|
|
||||||
- { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 }
|
|
||||||
speed: 100
|
|
||||||
duplex: full
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/3
|
|
||||||
- name: GigabitEthernet0/0/0/2
|
|
||||||
enabled: False
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/3 shutdown" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/3
|
|
||||||
- name: GigabitEthernet0/0/0/2
|
|
||||||
enabled: True
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"no interface GigabitEthernet0/0/0/3 shutdown" in result.commands'
|
|
||||||
- '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands'
|
|
||||||
|
|
||||||
- name: interface aggregate (setup)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/4
|
|
||||||
- name: GigabitEthernet0/0/0/5
|
|
||||||
description: test-interface-initial
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Create interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/4
|
|
||||||
description: test_interface_1
|
|
||||||
- name: GigabitEthernet0/0/0/5
|
|
||||||
description: test_interface_2
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"interface GigabitEthernet0/0/0/4 description test_interface_1" in result.commands'
|
|
||||||
- '"interface GigabitEthernet0/0/0/5 description test_interface_2" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/4
|
|
||||||
- name: GigabitEthernet0/0/0/5
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"no interface GigabitEthernet0/0/0/4" in result.commands'
|
|
||||||
- '"no interface GigabitEthernet0/0/0/5" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/4
|
|
||||||
- name: GigabitEthernet0/0/0/5
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- debug: msg="END net_interface iosxr/basic.yaml"
|
|
|
@ -1,72 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_interface iosxr/intent.yaml"
|
|
||||||
|
|
||||||
- name: Setup (interface is up)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/5
|
|
||||||
description: test_interface_5
|
|
||||||
enabled: True
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Check intent arguments
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/5
|
|
||||||
state: up
|
|
||||||
delay: 20
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Check intent arguments (failed condition)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/5
|
|
||||||
state: down
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(down)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Config + intent
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/5
|
|
||||||
enabled: False
|
|
||||||
state: down
|
|
||||||
delay: 20
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Config + intent (fail)
|
|
||||||
net_interface:
|
|
||||||
name: GigabitEthernet0/0/0/5
|
|
||||||
enabled: False
|
|
||||||
state: up
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(up)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Aggregate config + intent (pass)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: GigabitEthernet0/0/0/5
|
|
||||||
enabled: True
|
|
||||||
state: up
|
|
||||||
delay: 20
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
|
@ -1,224 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_interface netconf/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup remove interface
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: Create interface
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
|
||||||
- "'<description>test-interface</description>' in config.xml"
|
|
||||||
|
|
||||||
- name: Create interface (idempotent)
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: Configure interface attributes
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
state: present
|
|
||||||
speed: 1g
|
|
||||||
mtu: 256
|
|
||||||
duplex: full
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
|
||||||
- "'<link-mode>full-duplex</link-mode>' in config.xml"
|
|
||||||
- "'<mtu>256</mtu>' in config.xml"
|
|
||||||
- "'<speed>1g</speed>' in config.xml"
|
|
||||||
- "'<description>test-interface</description>' in config.xml"
|
|
||||||
|
|
||||||
- name: Disable interface
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
enabled: False
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
|
|
||||||
- name: Enable interface
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
enabled: True
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\- *disable")
|
|
||||||
|
|
||||||
- name: Delete interface
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
description: test-interface
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>ge-0/0/1</name>' not in config.xml"
|
|
||||||
|
|
||||||
- name: Aggregate setup- delete interface ge-0/0/1
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Aggregate setup- delete interface ge-0/0/2
|
|
||||||
net_interface:
|
|
||||||
name: ge-0/0/2
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Set interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: ge-0/0/1, description: test-interface-1, speed: 1g, mtu: 512}
|
|
||||||
- { name: ge-0/0/2, description: test-interface-2, speed: 10m, mtu: 256}
|
|
||||||
duplex: full
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- result.diff.prepared is search("\+ *ge-0/0/1")
|
|
||||||
- result.diff.prepared is search("\+ *description test-interface-1")
|
|
||||||
- result.diff.prepared is search("\+ *speed 1g")
|
|
||||||
- result.diff.prepared is search("\+ *mtu 512")
|
|
||||||
- result.diff.prepared is search("\+ *link-mode full-duplex")
|
|
||||||
- result.diff.prepared is search("\+ *description test-interface-2")
|
|
||||||
- result.diff.prepared is search("\+ *speed 10m")
|
|
||||||
- result.diff.prepared is search("\+ * mtu 256")
|
|
||||||
- result.diff.prepared is search("\+ *link-mode full-duplex")
|
|
||||||
|
|
||||||
- name: Set interface on aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: ge-0/0/1, description: test-interface-1, speed: 1g, mtu: 512 }
|
|
||||||
- { name: ge-0/0/2, description: test-interface-2, speed: 10m, mtu: 256 }
|
|
||||||
duplex: full
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
enabled: False
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
|
|
||||||
- name: Enable interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
enabled: True
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- result.diff.prepared is search("\- *disable")
|
|
||||||
|
|
||||||
- name: Delete interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: ge-0/0/1, description: test-interface-1 }
|
|
||||||
- { name: ge-0/0/2, description: test-interface-2 }
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- result.diff.prepared is search("\- *ge-0/0/1")
|
|
||||||
- result.diff.prepared is search("\- *description test-interface-1")
|
|
||||||
- result.diff.prepared is search("\- *speed 1g")
|
|
||||||
- result.diff.prepared is search("\- *mtu 512")
|
|
||||||
- result.diff.prepared is search("\- *link-mode full-duplex")
|
|
||||||
- result.diff.prepared is search("\- *description test-interface-2")
|
|
||||||
- result.diff.prepared is search("\- *speed 10m")
|
|
||||||
- result.diff.prepared is search("\- * mtu 256")
|
|
||||||
- result.diff.prepared is search("\- *link-mode full-duplex")
|
|
||||||
|
|
||||||
- name: Delete interface on aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
|
@ -1,89 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_interface junos/intent.yaml"
|
|
||||||
|
|
||||||
- name: get facts
|
|
||||||
junos_facts:
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
|
|
||||||
- name: Define interface name for vSRX
|
|
||||||
set_fact:
|
|
||||||
name: pp0
|
|
||||||
when: result['ansible_facts']['ansible_net_model'] is search("vSRX*")
|
|
||||||
|
|
||||||
- name: Define interface name for vQFX
|
|
||||||
set_fact:
|
|
||||||
name: gr-0/0/0
|
|
||||||
when: result['ansible_facts']['ansible_net_model'] is search("vqfx*")
|
|
||||||
|
|
||||||
- name: Check intent arguments
|
|
||||||
net_interface:
|
|
||||||
name: "{{ name }}"
|
|
||||||
state: up
|
|
||||||
tx_rate: ge(0)
|
|
||||||
rx_rate: le(0)
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Check intent arguments (failed condition)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ name }}"
|
|
||||||
state: down
|
|
||||||
tx_rate: gt(0)
|
|
||||||
rx_rate: lt(0)
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(down)' in result.failed_conditions"
|
|
||||||
- "'tx_rate gt(0)' in result.failed_conditions"
|
|
||||||
- "'rx_rate lt(0)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Config + intent
|
|
||||||
net_interface:
|
|
||||||
name: "{{ name }}"
|
|
||||||
enabled: False
|
|
||||||
state: down
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
|
|
||||||
- name: Config + intent (fail)
|
|
||||||
net_interface:
|
|
||||||
name: "{{ name }}"
|
|
||||||
enabled: False
|
|
||||||
state: up
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(up)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Aggregate config + intent (pass)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: "{{ name }}"
|
|
||||||
enabled: True
|
|
||||||
state: up
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,223 +0,0 @@
|
||||||
---
|
|
||||||
- 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: Set up - Create interface
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
state: present
|
|
||||||
description: test-interface
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces ethernet eth1" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth1 description test-interface" in result.commands'
|
|
||||||
|
|
||||||
- name: Configure interface params
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
state: present
|
|
||||||
description: test-interface-1
|
|
||||||
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:
|
|
||||||
name: eth1
|
|
||||||
enabled: False
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces ethernet eth1 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
enabled: True
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface (idempotent)
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Aggregate setup- delete interface
|
|
||||||
net_interface:
|
|
||||||
name: eth2
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Set interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- { 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 == 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 512" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth2 description test-interface-2" in result.commands'
|
|
||||||
- '"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:
|
|
||||||
aggregate:
|
|
||||||
- { 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
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces ethernet eth1 disable" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth2 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable interface on aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: eth1
|
|
||||||
- name: eth2
|
|
||||||
enabled: True
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1 disable" in result.commands'
|
|
||||||
- '"delete interfaces ethernet eth2 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface aggregate
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: eth1
|
|
||||||
- name: eth2
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1" in result.commands'
|
|
||||||
- '"delete interfaces ethernet eth2" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete interface aggregate (idempotent)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: eth1
|
|
||||||
- name: eth2
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
|
|
||||||
- debug: msg="END net_interface vyos/basic.yaml"
|
|
|
@ -1,137 +0,0 @@
|
||||||
---
|
|
||||||
- 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
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Check intent arguments
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
state: up
|
|
||||||
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
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "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
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == false"
|
|
||||||
|
|
||||||
- name: Config + intent (fail)
|
|
||||||
net_interface:
|
|
||||||
name: eth1
|
|
||||||
enabled: False
|
|
||||||
state: up
|
|
||||||
ignore_errors: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.failed == true"
|
|
||||||
- "'state eq(up)' in result.failed_conditions"
|
|
||||||
|
|
||||||
- name: Aggregate config + intent (pass)
|
|
||||||
net_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: eth1
|
|
||||||
enabled: True
|
|
||||||
state: up
|
|
||||||
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]"
|
|
|
@ -1 +0,0 @@
|
||||||
network/ci
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/eos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_l3_interface eos/basic.yaml"
|
|
|
@ -1,183 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_l3_interface junos/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup - remove interface address
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: Configure interface address
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>1.1.1.1/32</name>' in config.xml"
|
|
||||||
- "'<name>fd5d:12c9:2201:1::1/128</name>' in config.xml"
|
|
||||||
- result.diff.prepared is search("\+ *address 1.1.1.1/32")
|
|
||||||
- result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128")
|
|
||||||
|
|
||||||
- name: Configure interface address (idempotent)
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: Delete interface address
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>1.1.1.1/32</name>' not in config.xml"
|
|
||||||
- "'<name>fd5d:12c9:2201:1::1/128</name>' not in config.xml"
|
|
||||||
- result.diff.prepared is search("\- *address 1.1.1.1/32")
|
|
||||||
- result.diff.prepared is search("\- *address fd5d:12c9:2201:1::1/128")
|
|
||||||
|
|
||||||
- name: Delete interface address (idempotent)
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: Aggregate setup- delete interface ge-0/0/1
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Aggregate setup- delete interface ge-0/0/2
|
|
||||||
net_l3_interface:
|
|
||||||
name: ge-0/0/2
|
|
||||||
ipv4: 2.2.2.2
|
|
||||||
ipv6: fd5d:12c9:2201:2::2
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Configure l3 interface in aggregate
|
|
||||||
net_l3_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
ipv4: 2.2.2.2
|
|
||||||
ipv6: fd5d:12c9:2201:2::2
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\+ *address 1.1.1.1/32")
|
|
||||||
- "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128")
|
|
||||||
- "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\+ *address 2.2.2.2/32")
|
|
||||||
- "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\+ *address fd5d:12c9:2201:2::2/128")
|
|
||||||
|
|
||||||
- name: Configure l3 interface in aggregate (idempotent)
|
|
||||||
net_l3_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
ipv4: 2.2.2.2
|
|
||||||
ipv6: fd5d:12c9:2201:2::2
|
|
||||||
active: True
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Delete l3 interface configuration
|
|
||||||
net_l3_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
ipv4: 2.2.2.2
|
|
||||||
ipv6: fd5d:12c9:2201:2::2
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\- *address 1.1.1.1/32")
|
|
||||||
- "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\- *address fd5d:12c9:2201:1::1/128")
|
|
||||||
- "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\- *address 2.2.2.2/32")
|
|
||||||
- "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared"
|
|
||||||
- result.diff.prepared is search("\- *address fd5d:12c9:2201:2::2/128")
|
|
||||||
|
|
||||||
- name: Delete l3 interface configuration (idempotent)
|
|
||||||
net_l3_interface:
|
|
||||||
aggregate:
|
|
||||||
- name: ge-0/0/1
|
|
||||||
ipv4: 1.1.1.1
|
|
||||||
ipv6: fd5d:12c9:2201:1::1
|
|
||||||
- name: ge-0/0/2
|
|
||||||
ipv4: 2.2.2.2
|
|
||||||
ipv6: fd5d:12c9:2201:2::2
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,15 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all cli test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/cli"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/vyos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
|
|
|
@ -1,240 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_linkagg junos/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup - remove linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: configure linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<name>ae0</name>' in config.xml"
|
|
||||||
- "'<device-count>4</device-count>' in config.xml"
|
|
||||||
- "'<bundle>ae0</bundle>' in config.xml"
|
|
||||||
- "'<active/>' in config.xml"
|
|
||||||
|
|
||||||
- name: configure linkagg (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: configure lacp in passive
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: passive
|
|
||||||
device_count: 4
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<passive/>' in config.xml"
|
|
||||||
|
|
||||||
- name: delete lacp
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: off
|
|
||||||
device_count: 4
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<lacp/>' not in config.xml"
|
|
||||||
|
|
||||||
- name: Change device count
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
device_count: 2
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<device-count>2</device-count>' in config.xml"
|
|
||||||
|
|
||||||
- name: Disable linkagg interface
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
state: down
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
|
|
||||||
- name: Enable linkagg interface
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
state: up
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\- *disable")
|
|
||||||
|
|
||||||
- name: Deactivate linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
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"
|
|
||||||
- "'<bundle inactive=\"inactive\">ae0</bundle>' in config.xml"
|
|
||||||
- "'<device-count inactive=\"inactive\">4</device-count>' in config.xml"
|
|
||||||
- "'inactive: ae0' in result.diff.prepared"
|
|
||||||
|
|
||||||
- name: Activate linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
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"
|
|
||||||
- "'<active/>' in config.xml"
|
|
||||||
- "'<bundle>ae0</bundle>' in config.xml"
|
|
||||||
- "'active: device-count 4' in result.diff.prepared"
|
|
||||||
- "'active: ae0' in result.diff.prepared"
|
|
||||||
|
|
||||||
- name: Delete linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Get running configuration
|
|
||||||
junos_rpc:
|
|
||||||
rpc: get-configuration
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: config
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'<active/>' not in config.xml"
|
|
||||||
- "'<bundle>ae0</bundle>' not in config.xml"
|
|
||||||
- "'<device-count>4</device-count>' not in config.xml"
|
|
||||||
- "'<name>ae0</name>' not in config.xml"
|
|
||||||
|
|
||||||
- name: Delete linkagg (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: ae0
|
|
||||||
members:
|
|
||||||
- ge-0/0/6
|
|
||||||
- ge-0/0/7
|
|
||||||
mode: active
|
|
||||||
device_count: 4
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- debug: msg="END net_linkagg junos/basic.yaml"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,182 +0,0 @@
|
||||||
---
|
|
||||||
- name: Remove linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Remove linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond1
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Create linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
members:
|
|
||||||
- eth1
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
|
||||||
|
|
||||||
- name: Create linkagg again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
members:
|
|
||||||
- eth1
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Add linkagg member
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
members:
|
|
||||||
- eth2
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
|
|
||||||
|
|
||||||
- name: Add linkagg member again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
members:
|
|
||||||
- eth2
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: down
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces bonding bond0 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Disable linkagg again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: down
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Enable linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: up
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces bonding bond0 disable" in result.commands[0]'
|
|
||||||
|
|
||||||
- name: Enable linkagg again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: up
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Remove linkagg
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces bonding bond0" in result.commands'
|
|
||||||
|
|
||||||
- name: Remove linkagg again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
name: bond0
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Create collection of linkagg definitions
|
|
||||||
net_linkagg:
|
|
||||||
aggregate:
|
|
||||||
- { name: bond0, members: [eth1] }
|
|
||||||
- { name: bond1, members: [eth2] }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
|
||||||
- '"set interfaces bonding bond1 mode 802.3ad" in result.commands'
|
|
||||||
- '"set interfaces ethernet eth2 bond-group bond1" in result.commands'
|
|
||||||
|
|
||||||
- name: Create collection of linkagg definitions again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
aggregate:
|
|
||||||
- { name: bond0, members: [eth1] }
|
|
||||||
- { name: bond1, members: [eth2] }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Remove collection of linkagg definitions
|
|
||||||
net_linkagg:
|
|
||||||
aggregate:
|
|
||||||
- name: bond0
|
|
||||||
- name: bond1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces bonding bond0" in result.commands'
|
|
||||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces bonding bond1" in result.commands'
|
|
||||||
|
|
||||||
- name: Remove collection of linkagg definitions again (idempotent)
|
|
||||||
net_linkagg:
|
|
||||||
aggregate:
|
|
||||||
- name: bond0
|
|
||||||
- name: bond1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
|
@ -1 +0,0 @@
|
||||||
network/ci
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
||||||
test_items: []
|
|
|
@ -1,15 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all cli test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/cli"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/vyos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
|
|
|
@ -1,117 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_lldp junos/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup - Disable lldp and remove it's configuration
|
|
||||||
net_lldp:
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: Enable lldp
|
|
||||||
net_lldp:
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
|
|
||||||
- name: Enable lldp (idempotent)
|
|
||||||
net_lldp:
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- 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 is search("\+ *advertisement-interval 10")
|
|
||||||
- result.diff.prepared is search("\+ *transmit-delay 2")
|
|
||||||
- result.diff.prepared is 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 is 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 is 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
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
- result.diff.prepared is search("\- *advertisement-interval 10")
|
|
||||||
- result.diff.prepared is search("\- *transmit-delay 2")
|
|
||||||
- result.diff.prepared is search("\- *hold-multiplier 5")
|
|
||||||
|
|
||||||
- name: Remove lldp (idempotent)
|
|
||||||
net_lldp:
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,42 +0,0 @@
|
||||||
---
|
|
||||||
- name: Make sure LLDP is not running before tests
|
|
||||||
vyos_config:
|
|
||||||
lines: delete service lldp
|
|
||||||
|
|
||||||
- name: Enable LLDP service
|
|
||||||
net_lldp:
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set service lldp" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable LLDP service again (idempotent)
|
|
||||||
net_lldp:
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable LLDP service
|
|
||||||
net_lldp:
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete service lldp" in result.commands'
|
|
||||||
|
|
||||||
- name:
|
|
||||||
net_lldp:
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
|
@ -1 +0,0 @@
|
||||||
network/ci
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
||||||
test_items: []
|
|
|
@ -1,15 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all cli test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/cli"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- { include: cli.yaml, tags: ['cli'] }
|
|
||||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
- name: collect all netconf test cases
|
|
||||||
find:
|
|
||||||
paths: "{{ role_path }}/tests/netconf"
|
|
||||||
patterns: "{{ testcase }}.yaml"
|
|
||||||
register: test_cases
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: set test_items
|
|
||||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
|
||||||
|
|
||||||
- name: run test case
|
|
||||||
include: "{{ test_case_to_run }}"
|
|
||||||
with_items: "{{ test_items }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: test_case_to_run
|
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- include: "{{ role_path }}/tests/vyos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
|
|
|
@ -1,106 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START net_lldp_interface junos/basic.yaml"
|
|
||||||
|
|
||||||
- name: setup - Remove lldp interface configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
|
|
||||||
- name: lldp interface configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\+ *interface ge-0/0/5")
|
|
||||||
|
|
||||||
- name: lldp interface configuration (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: present
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: Deactivate lldp interface configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: present
|
|
||||||
active: False
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("! *inactive[:] interface ge-0/0/5")
|
|
||||||
|
|
||||||
- name: Activate lldp interface configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: present
|
|
||||||
active: True
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("! *active[:] interface ge-0/0/5")
|
|
||||||
|
|
||||||
- name: Disable lldp on particular interface
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: disabled
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\+ *disable")
|
|
||||||
|
|
||||||
- name: Enable lldp on particular interface
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: enabled
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\- *disable")
|
|
||||||
|
|
||||||
- name: Delete lldp on particular interface
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- result.diff.prepared is search("\- *interface ge-0/0/5")
|
|
||||||
|
|
||||||
- name: Delete lldp on particular interface (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: ge-0/0/5
|
|
||||||
state: absent
|
|
||||||
provider: "{{ netconf }}"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- debug: msg="END net_lldp_interface junos/basic.yaml"
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
|
||||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
|
|
@ -1,165 +0,0 @@
|
||||||
---
|
|
||||||
- name: Make sure LLDP is not running before tests
|
|
||||||
vyos_config:
|
|
||||||
lines: delete service lldp
|
|
||||||
|
|
||||||
- name: Create LLDP configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set service lldp interface eth1" in result.commands'
|
|
||||||
|
|
||||||
- name: Create LLDP configuration again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Disable LLDP configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: disabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set service lldp interface eth1 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Disable LLDP configuration again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: disabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Enable LLDP configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: enabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete service lldp interface eth1 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Enable LLDP configuration again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: enabled
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Delete LLDP configuration
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete service lldp interface eth1" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete LLDP configuration again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
name: eth1
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Create aggregate of LLDP interface configurations
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2 }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set service lldp interface eth1" in result.commands'
|
|
||||||
- '"set service lldp interface eth2" in result.commands'
|
|
||||||
|
|
||||||
- name: Create aggregate of LLDP interface configurations again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2 }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Override LLDP interface configuration on aggregate
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2, state: disabled }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"set service lldp interface eth2 disable" in result.commands'
|
|
||||||
|
|
||||||
- name: Override LLDP interface configuration on aggregate again (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2, state: disabled }
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
||||||
|
|
||||||
- name: Delete aggregate of LLDP interface configurations
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2 }
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == true'
|
|
||||||
- '"delete service lldp interface eth1" in result.commands'
|
|
||||||
- '"delete service lldp interface eth2" in result.commands'
|
|
||||||
|
|
||||||
- name: Delete aggregate of LLDP interface configurations (idempotent)
|
|
||||||
net_lldp_interface:
|
|
||||||
aggregate:
|
|
||||||
- { name: eth1 }
|
|
||||||
- { name: eth2 }
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- 'result.changed == false'
|
|
|
@ -1,2 +0,0 @@
|
||||||
---
|
|
||||||
testcase: "*"
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue