mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 22:30:04 -07:00
Initial commit
This commit is contained in:
commit
aebc1b03fd
4861 changed files with 812621 additions and 0 deletions
0
tests/integration/targets/__init__.py
Normal file
0
tests/integration/targets/__init__.py
Normal file
2
tests/integration/targets/aix_devices/aliases
Normal file
2
tests/integration/targets/aix_devices/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
# No AIX LPAR available
|
||||
unsupported
|
71
tests/integration/targets/aix_devices/tasks/main.yml
Normal file
71
tests/integration/targets/aix_devices/tasks/main.yml
Normal file
|
@ -0,0 +1,71 @@
|
|||
- name: Scan new devices.
|
||||
aix_devices:
|
||||
device: all
|
||||
state: present
|
||||
|
||||
- name: Scan new virtual devices (vio0).
|
||||
aix_devices:
|
||||
device: vio0
|
||||
state: present
|
||||
|
||||
- name: Removing IP alias to en0
|
||||
aix_devices:
|
||||
device: en0
|
||||
attributes:
|
||||
delalias4: 10.0.0.100,255.255.255.0
|
||||
|
||||
- name: Removes ent2.
|
||||
aix_devices:
|
||||
device: ent2
|
||||
state: absent
|
||||
|
||||
- name: Put device en2 in Defined
|
||||
aix_devices:
|
||||
device: en2
|
||||
state: defined
|
||||
|
||||
- name: Removes ent4 (inexistent).
|
||||
aix_devices:
|
||||
device: ent4
|
||||
state: absent
|
||||
|
||||
- name: Put device en4 in Defined (inexistent)
|
||||
aix_devices:
|
||||
device: en4
|
||||
state: defined
|
||||
|
||||
- name: Put vscsi1 and children devices in Defined state.
|
||||
aix_devices:
|
||||
device: vscsi1
|
||||
recursive: yes
|
||||
state: defined
|
||||
|
||||
- name: Removes vscsi1 and children devices.
|
||||
aix_devices:
|
||||
device: vscsi1
|
||||
recursive: yes
|
||||
state: absent
|
||||
|
||||
- name: Changes en1 mtu to 9000 and disables arp.
|
||||
aix_devices:
|
||||
device: en1
|
||||
attributes:
|
||||
mtu: 900
|
||||
arp: off
|
||||
state: present
|
||||
|
||||
- name: Configure IP, netmask and set en1 up.
|
||||
aix_devices:
|
||||
device: en1
|
||||
attributes:
|
||||
netaddr: 192.168.0.100
|
||||
netmask: 255.255.255.0
|
||||
state: up
|
||||
state: present
|
||||
|
||||
- name: Adding IP alias to en0
|
||||
aix_devices:
|
||||
device: en0
|
||||
attributes:
|
||||
alias4: 10.0.0.100,255.255.255.0
|
||||
state: present
|
1
tests/integration/targets/aix_filesystem/aliases
Normal file
1
tests/integration/targets/aix_filesystem/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
unsupported
|
120
tests/integration/targets/aix_filesystem/tasks/main.yml
Normal file
120
tests/integration/targets/aix_filesystem/tasks/main.yml
Normal file
|
@ -0,0 +1,120 @@
|
|||
- name: Umounting /testfs
|
||||
aix_filesystem:
|
||||
filesystem: /testfs
|
||||
state: unmounted
|
||||
|
||||
- name: Removing /testfs
|
||||
aix_filesystem:
|
||||
filesystem: /testfs
|
||||
state: absent
|
||||
|
||||
- name: Creating a new file system
|
||||
aix_filesystem:
|
||||
filesystem: /newfs
|
||||
size: 1G
|
||||
state: present
|
||||
vg: datavg
|
||||
|
||||
# It requires a host (nfshost) exporting the NFS
|
||||
- name: Creating NFS filesystem from nfshost (Linux NFS server)
|
||||
aix_filesystem:
|
||||
device: /home/ftp
|
||||
nfs_server: nfshost
|
||||
filesystem: /nfs/ftp
|
||||
state: present
|
||||
|
||||
# It requires a volume group named datavg (next three actions)
|
||||
- name: Creating a logical volume testlv (aix_lvol module)
|
||||
aix_lvol:
|
||||
vg: datavg
|
||||
lv: testlv
|
||||
size: 2G
|
||||
state: present
|
||||
|
||||
- name: Create filesystem in a previously defined logical volume
|
||||
aix_filesystem:
|
||||
device: testlv
|
||||
filesystem: /testfs
|
||||
state: present
|
||||
|
||||
- name: Create an already existing filesystem using existing logical volume.
|
||||
aix_filesystem:
|
||||
vg: datavg
|
||||
device: mksysblv
|
||||
filesystem: /mksysb
|
||||
state: present
|
||||
|
||||
- name: Create a filesystem in a non-existing VG
|
||||
aix_filesystem:
|
||||
vg: nonexistvg
|
||||
filesystem: /newlv
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to 1G
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: 1G
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to +512M
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: +512M
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to 11G
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: 11G
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to 11G (already done)
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: 11G
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to -2G
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: -2G
|
||||
state: present
|
||||
|
||||
- name: Resizing /mksysb to 100G (no enought space)
|
||||
aix_filesystem:
|
||||
filesystem: /mksysb
|
||||
size: +100G
|
||||
state: present
|
||||
|
||||
- name: Unmount filesystem /home/ftp
|
||||
aix_filesystem:
|
||||
filesystem: /home/ftp
|
||||
state: unmounted
|
||||
|
||||
- name: Remove NFS filesystem /home/ftp
|
||||
aix_filesystem:
|
||||
filesystem: /home/ftp
|
||||
rm_mount_point: yes
|
||||
state: absent
|
||||
|
||||
- name: Mount filesystem /newfs
|
||||
aix_filesystem:
|
||||
filesystem: /newfs
|
||||
state: mounted
|
||||
|
||||
- name: Remove mounted /newfs
|
||||
aix_filesystem:
|
||||
filesystem: /newfs
|
||||
rm_mount_point: yes
|
||||
state: absent
|
||||
|
||||
- name: Umount /newfs
|
||||
aix_filesystem:
|
||||
filesystem: /newfs
|
||||
state: unmounted
|
||||
|
||||
- name: Remove /newfs
|
||||
aix_filesystem:
|
||||
filesystem: /newfs
|
||||
rm_mount_point: yes
|
||||
state: absent
|
6
tests/integration/targets/alternatives/aliases
Normal file
6
tests/integration/targets/alternatives/aliases
Normal file
|
@ -0,0 +1,6 @@
|
|||
shippable/posix/group3
|
||||
destructive
|
||||
needs/root
|
||||
skip/aix
|
||||
skip/freebsd
|
||||
skip/osx
|
66
tests/integration/targets/alternatives/tasks/main.yml
Normal file
66
tests/integration/targets/alternatives/tasks/main.yml
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Copyright (c) 2017 Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: 'setup: create a dummy alternative'
|
||||
block:
|
||||
- import_tasks: setup.yml
|
||||
|
||||
##############
|
||||
# Test parameters:
|
||||
# link parameter present / absent ('with_link' variable)
|
||||
# with / without alternatives defined in alternatives file ('with_alternatives' variable)
|
||||
# auto / manual ('mode' variable)
|
||||
|
||||
- include_tasks: tests.yml
|
||||
with_nested:
|
||||
- [ True, False ] # with_link
|
||||
- [ True, False ] # with_alternatives
|
||||
- [ 'auto', 'manual' ] # mode
|
||||
loop_control:
|
||||
loop_var: test_conf
|
||||
|
||||
##########
|
||||
# Priority
|
||||
- block:
|
||||
- include_tasks: remove_links.yml
|
||||
- include_tasks: setup_test.yml
|
||||
# at least two iterations again
|
||||
- include_tasks: tests_set_priority.yml
|
||||
with_sequence: start=3 end=4
|
||||
vars:
|
||||
with_alternatives: True
|
||||
mode: auto
|
||||
|
||||
- block:
|
||||
- include_tasks: remove_links.yml
|
||||
- include_tasks: setup_test.yml
|
||||
# at least two iterations again
|
||||
- include_tasks: tests_set_priority.yml
|
||||
with_sequence: start=3 end=4
|
||||
vars:
|
||||
with_alternatives: False
|
||||
mode: auto
|
||||
|
||||
# Test that path is checked: alternatives must fail when path is nonexistent
|
||||
- import_tasks: path_is_checked.yml
|
||||
|
||||
always:
|
||||
- include_tasks: remove_links.yml
|
||||
|
||||
- file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- '{{ alternatives_dir }}/dummy'
|
||||
|
||||
- file:
|
||||
path: '/usr/bin/dummy{{ item }}'
|
||||
state: absent
|
||||
with_sequence: start=1 end=4
|
||||
# *Disable tests on Fedora 24*
|
||||
# Shippable Fedora 24 image provides chkconfig-1.7-2.fc24.x86_64 but not the
|
||||
# latest available version (chkconfig-1.8-1.fc24.x86_64). update-alternatives
|
||||
# in chkconfig-1.7-2 fails when /etc/alternatives/dummy link is missing,
|
||||
# error is: 'failed to read link /usr/bin/dummy: No such file or directory'.
|
||||
# Moreover Fedora 24 is no longer maintained.
|
||||
when: ansible_distribution != 'Fedora' or ansible_distribution_major_version|int > 24
|
|
@ -0,0 +1,12 @@
|
|||
- name: Try with nonexistent path
|
||||
alternatives:
|
||||
name: dummy
|
||||
path: '/non/existent/path/there'
|
||||
link: '/usr/bin/dummy'
|
||||
ignore_errors: True
|
||||
register: alternative
|
||||
|
||||
- name: Check previous task failed
|
||||
assert:
|
||||
that:
|
||||
- 'alternative is failed'
|
|
@ -0,0 +1,7 @@
|
|||
- name: remove links
|
||||
file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
with_items:
|
||||
- /etc/alternatives/dummy
|
||||
- /usr/bin/dummy
|
14
tests/integration/targets/alternatives/tasks/setup.yml
Normal file
14
tests/integration/targets/alternatives/tasks/setup.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- include_vars: '{{ item }}'
|
||||
with_first_found:
|
||||
- files:
|
||||
- '{{ ansible_os_family }}-{{ ansible_distribution_version }}.yml'
|
||||
- '{{ ansible_os_family }}.yml'
|
||||
- default.yml
|
||||
paths: ../vars
|
||||
- template:
|
||||
src: dummy_command
|
||||
dest: /usr/bin/dummy{{ item }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
with_sequence: start=1 end=4
|
11
tests/integration/targets/alternatives/tasks/setup_test.yml
Normal file
11
tests/integration/targets/alternatives/tasks/setup_test.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- template:
|
||||
src: dummy_alternative
|
||||
dest: '{{ alternatives_dir }}/dummy'
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
when: with_alternatives or ansible_os_family != 'RedHat'
|
||||
- file:
|
||||
path: '{{ alternatives_dir }}/dummy'
|
||||
state: absent
|
||||
when: not with_alternatives and ansible_os_family == 'RedHat'
|
53
tests/integration/targets/alternatives/tasks/test.yml
Normal file
53
tests/integration/targets/alternatives/tasks/test.yml
Normal file
|
@ -0,0 +1,53 @@
|
|||
- debug:
|
||||
msg: ' with_alternatives: {{ with_alternatives }}, mode: {{ mode }}'
|
||||
|
||||
- block:
|
||||
- name: set alternative (using link parameter)
|
||||
alternatives:
|
||||
name: dummy
|
||||
path: '/usr/bin/dummy{{ item }}'
|
||||
link: '/usr/bin/dummy'
|
||||
register: alternative
|
||||
|
||||
- name: check expected command was executed
|
||||
assert:
|
||||
that:
|
||||
- 'alternative is successful'
|
||||
- 'alternative is changed'
|
||||
when: with_link
|
||||
|
||||
- block:
|
||||
- name: set alternative (without link parameter)
|
||||
alternatives:
|
||||
name: dummy
|
||||
path: '/usr/bin/dummy{{ item }}'
|
||||
register: alternative
|
||||
|
||||
- name: check expected command was executed
|
||||
assert:
|
||||
that:
|
||||
- 'alternative is successful'
|
||||
- 'alternative is changed'
|
||||
when: not with_link
|
||||
|
||||
- name: execute dummy command
|
||||
shell: dummy
|
||||
register: cmd
|
||||
|
||||
- name: check expected command was executed
|
||||
assert:
|
||||
that:
|
||||
- 'cmd.stdout == "dummy" ~ item'
|
||||
|
||||
- name: 'check mode (manual: alternatives file existed, it has been updated)'
|
||||
shell: 'head -n1 {{ alternatives_dir }}/dummy | grep "^manual$"'
|
||||
when: ansible_os_family != 'RedHat' or with_alternatives or item != 1
|
||||
|
||||
- name: 'check mode (auto: alternatives file didn''t exist, it has been created)'
|
||||
shell: 'head -n1 {{ alternatives_dir }}/dummy | grep "^auto$"'
|
||||
when: ansible_os_family == 'RedHat' and not with_alternatives and item == 1
|
||||
|
||||
- name: check that alternative has been updated
|
||||
command: "grep -Pzq '/bin/dummy{{ item }}\\n' '{{ alternatives_dir }}/dummy'"
|
||||
# priority doesn't seem updated
|
||||
#command: "grep -Pzq '/bin/dummy{{ item }}\\n50' '{{ alternatives_dir }}/dummy'"
|
15
tests/integration/targets/alternatives/tasks/tests.yml
Normal file
15
tests/integration/targets/alternatives/tasks/tests.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
- block:
|
||||
- include_tasks: remove_links.yml
|
||||
- include_tasks: setup_test.yml
|
||||
# at least two iterations:
|
||||
# - first will use 'link currently absent',
|
||||
# - second will receive 'link currently points to'
|
||||
- include_tasks: test.yml
|
||||
with_sequence: start=1 end=2
|
||||
vars:
|
||||
with_link: '{{ test_conf[0] }}'
|
||||
with_alternatives: '{{ test_conf[1] }}'
|
||||
mode: '{{ test_conf[2] }}'
|
||||
# update-alternatives included in Fedora 26 (1.10) & Red Hat 7.4 (1.8) doesn't provide
|
||||
# '--query' switch, 'link' is mandatory for these distributions.
|
||||
when: ansible_os_family != 'RedHat' or test_conf[0]
|
|
@ -0,0 +1,23 @@
|
|||
- name: update dummy alternative
|
||||
alternatives:
|
||||
name: dummy
|
||||
path: '/usr/bin/dummy{{ item }}'
|
||||
link: /usr/bin/dummy
|
||||
priority: '{{ 60 + item|int }}'
|
||||
register: alternative
|
||||
|
||||
- name: execute dummy command
|
||||
shell: dummy
|
||||
register: cmd
|
||||
|
||||
- name: check if link group is in manual mode
|
||||
shell: 'head -n1 {{ alternatives_dir }}/dummy | grep "^manual$"'
|
||||
|
||||
- name: check expected command was executed
|
||||
assert:
|
||||
that:
|
||||
- 'alternative is changed'
|
||||
- 'cmd.stdout == "dummy{{ item }}"'
|
||||
|
||||
- name: check that alternative has been updated
|
||||
command: "grep -Pzq '/bin/dummy{{ item }}\\n{{ 60 + item|int }}' '{{ alternatives_dir }}/dummy'"
|
|
@ -0,0 +1,12 @@
|
|||
{{ mode }}
|
||||
/usr/bin/dummy
|
||||
|
||||
{% if with_alternatives %}
|
||||
/usr/bin/dummy1
|
||||
40
|
||||
/usr/bin/dummy2
|
||||
30
|
||||
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
echo dummy{{ item }}
|
2
tests/integration/targets/alternatives/vars/Debian.yml
Normal file
2
tests/integration/targets/alternatives/vars/Debian.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
alternatives_dir: /var/lib/dpkg/alternatives/
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
alternatives_dir: /var/lib/rpm/alternatives/
|
2
tests/integration/targets/alternatives/vars/default.yml
Normal file
2
tests/integration/targets/alternatives/vars/default.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
alternatives_dir: /var/lib/alternatives/
|
3
tests/integration/targets/apache2_module/aliases
Normal file
3
tests/integration/targets/apache2_module/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
destructive
|
||||
shippable/posix/group3
|
||||
skip/aix
|
2
tests/integration/targets/apache2_module/meta/main.yml
Normal file
2
tests/integration/targets/apache2_module/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_tests
|
231
tests/integration/targets/apache2_module/tasks/actualtest.yml
Normal file
231
tests/integration/targets/apache2_module/tasks/actualtest.yml
Normal file
|
@ -0,0 +1,231 @@
|
|||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: install apache via apt
|
||||
apt:
|
||||
name: "{{item}}"
|
||||
state: present
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
with_items:
|
||||
- apache2
|
||||
- libapache2-mod-evasive
|
||||
|
||||
- name: install apache via zypper
|
||||
package:
|
||||
name: apache2
|
||||
state: present
|
||||
when: "ansible_os_family == 'Suse'"
|
||||
|
||||
- name: disable userdir module
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: absent
|
||||
register: userdir_first_disable
|
||||
|
||||
- name: disable userdir module, second run
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: absent
|
||||
register: disable
|
||||
|
||||
- name: ensure apache2_module is idempotent
|
||||
assert:
|
||||
that:
|
||||
- disable is not changed
|
||||
|
||||
- name: enable userdir module
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: present
|
||||
register: enable
|
||||
|
||||
- name: ensure changed on successful enable
|
||||
assert:
|
||||
that:
|
||||
- enable is changed
|
||||
|
||||
- name: enable userdir module, second run
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: present
|
||||
register: enabletwo
|
||||
|
||||
- name: ensure apache2_module is idempotent
|
||||
assert:
|
||||
that:
|
||||
- 'not enabletwo.changed'
|
||||
|
||||
- name: disable userdir module, final run
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: absent
|
||||
register: disablefinal
|
||||
|
||||
- name: ensure changed on successful disable
|
||||
assert:
|
||||
that:
|
||||
- 'disablefinal.changed'
|
||||
|
||||
- name: set userdir to original state
|
||||
apache2_module:
|
||||
name: userdir
|
||||
state: present
|
||||
when: userdir_first_disable is changed
|
||||
|
||||
- name: ensure autoindex enabled
|
||||
apache2_module:
|
||||
name: autoindex
|
||||
state: present
|
||||
|
||||
- name: Debian/Ubuntu specific tests
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
block:
|
||||
- name: force disable of autoindex # bug #2499
|
||||
apache2_module:
|
||||
name: autoindex
|
||||
state: absent
|
||||
force: True
|
||||
|
||||
- name: reenable autoindex
|
||||
apache2_module:
|
||||
name: autoindex
|
||||
state: present
|
||||
|
||||
- name: enable evasive module, test https://github.com/ansible/ansible/issues/22635
|
||||
apache2_module:
|
||||
name: evasive
|
||||
state: present
|
||||
|
||||
- name: disable evasive module
|
||||
apache2_module:
|
||||
name: evasive
|
||||
state: absent
|
||||
|
||||
- name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
|
||||
apache2_module:
|
||||
name: dump_io
|
||||
state: present
|
||||
ignore_errors: True
|
||||
register: enable_dumpio_wrong
|
||||
|
||||
- name: disable dump_io
|
||||
apache2_module:
|
||||
name: dump_io
|
||||
identifier: dumpio_module
|
||||
state: absent
|
||||
|
||||
- name: use identifier to enable module, fix for https://github.com/ansible/ansible/issues/33669
|
||||
apache2_module:
|
||||
name: dump_io
|
||||
identifier: dumpio_module
|
||||
state: present
|
||||
register: enable_dumpio_correct_1
|
||||
|
||||
- name: ensure idempotency with identifier
|
||||
apache2_module:
|
||||
name: dump_io
|
||||
identifier: dumpio_module
|
||||
state: present
|
||||
register: enable_dumpio_correct_2
|
||||
|
||||
- name: disable dump_io
|
||||
apache2_module:
|
||||
name: dump_io
|
||||
identifier: dumpio_module
|
||||
state: absent
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- enable_dumpio_wrong is failed
|
||||
- enable_dumpio_correct_1 is changed
|
||||
- enable_dumpio_correct_2 is not changed
|
||||
|
||||
- name: disable mpm modules
|
||||
apache2_module:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
ignore_configcheck: True
|
||||
with_items:
|
||||
- mpm_worker
|
||||
- mpm_event
|
||||
- mpm_prefork
|
||||
|
||||
- name: enabled mpm_event
|
||||
apache2_module:
|
||||
name: mpm_event
|
||||
state: present
|
||||
ignore_configcheck: True
|
||||
register: enabledmpmevent
|
||||
|
||||
- name: ensure changed mpm_event
|
||||
assert:
|
||||
that:
|
||||
- 'enabledmpmevent.changed'
|
||||
|
||||
- name: switch between mpm_event and mpm_worker
|
||||
apache2_module:
|
||||
name: "{{ item.name }}"
|
||||
state: "{{ item.state }}"
|
||||
ignore_configcheck: True
|
||||
with_items:
|
||||
- name: mpm_event
|
||||
state: absent
|
||||
- name: mpm_worker
|
||||
state: present
|
||||
|
||||
- name: ensure mpm_worker is already enabled
|
||||
apache2_module:
|
||||
name: mpm_worker
|
||||
state: present
|
||||
register: enabledmpmworker
|
||||
|
||||
- name: ensure mpm_worker unchanged
|
||||
assert:
|
||||
that:
|
||||
- 'not enabledmpmworker.changed'
|
||||
|
||||
- name: try to disable all mpm modules with configcheck
|
||||
apache2_module:
|
||||
name: "{{item}}"
|
||||
state: absent
|
||||
with_items:
|
||||
- mpm_worker
|
||||
- mpm_event
|
||||
- mpm_prefork
|
||||
ignore_errors: yes
|
||||
register: remove_with_configcheck
|
||||
|
||||
- name: ensure configcheck fails task with when run without mpm modules
|
||||
assert:
|
||||
that:
|
||||
- "{{ item.failed }}"
|
||||
with_items: "{{ remove_with_configcheck.results }}"
|
||||
|
||||
- name: try to disable all mpm modules without configcheck
|
||||
apache2_module:
|
||||
name: "{{item}}"
|
||||
state: absent
|
||||
ignore_configcheck: True
|
||||
with_items:
|
||||
- mpm_worker
|
||||
- mpm_event
|
||||
- mpm_prefork
|
||||
|
||||
- name: enabled mpm_event to restore previous state
|
||||
apache2_module:
|
||||
name: mpm_event
|
||||
state: present
|
||||
ignore_configcheck: True
|
||||
register: enabledmpmevent
|
21
tests/integration/targets/apache2_module/tasks/main.yml
Normal file
21
tests/integration/targets/apache2_module/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
|
||||
|
||||
- name:
|
||||
block:
|
||||
- name: get list of enabled modules
|
||||
shell: apache2ctl -M | sort
|
||||
register: modules_before
|
||||
- name: include only on supported systems
|
||||
include: actualtest.yml
|
||||
always:
|
||||
- name: get list of enabled modules
|
||||
shell: apache2ctl -M | sort
|
||||
register: modules_after
|
||||
- debug: var=modules_before
|
||||
- debug: var=modules_after
|
||||
- name: ensure that all test modules are disabled again
|
||||
assert:
|
||||
that: modules_before.stdout == modules_after.stdout
|
||||
when: ansible_os_family in ['Debian', 'Suse']
|
||||
# centos/RHEL does not have a2enmod/a2dismod
|
4
tests/integration/targets/archive/aliases
Normal file
4
tests/integration/targets/archive/aliases
Normal file
|
@ -0,0 +1,4 @@
|
|||
needs/root
|
||||
shippable/posix/group2
|
||||
destructive
|
||||
skip/aix
|
1
tests/integration/targets/archive/files/bar.txt
Normal file
1
tests/integration/targets/archive/files/bar.txt
Normal file
|
@ -0,0 +1 @@
|
|||
bar.txt
|
0
tests/integration/targets/archive/files/empty.txt
Normal file
0
tests/integration/targets/archive/files/empty.txt
Normal file
1
tests/integration/targets/archive/files/foo.txt
Normal file
1
tests/integration/targets/archive/files/foo.txt
Normal file
|
@ -0,0 +1 @@
|
|||
foo.txt
|
2
tests/integration/targets/archive/meta/main.yml
Normal file
2
tests/integration/targets/archive/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_tests
|
340
tests/integration/targets/archive/tasks/main.yml
Normal file
340
tests/integration/targets/archive/tasks/main.yml
Normal file
|
@ -0,0 +1,340 @@
|
|||
# Test code for the archive module.
|
||||
# (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Make sure we start fresh
|
||||
|
||||
- name: Ensure zip is present to create test archive (yum)
|
||||
yum: name=zip state=latest
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: Ensure zip is present to create test archive (apt)
|
||||
apt: name=zip state=latest
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: Install prerequisites for backports.lzma when using python2 (non OSX)
|
||||
block:
|
||||
- name: Set liblzma package name depending on the OS
|
||||
set_fact:
|
||||
liblzma_dev_package:
|
||||
Debian: liblzma-dev
|
||||
RedHat: xz-devel
|
||||
Suse: xz-devel
|
||||
- name: Ensure liblzma-dev is present to install backports-lzma
|
||||
package: name={{ liblzma_dev_package[ansible_os_family] }} state=latest
|
||||
when: ansible_os_family in liblzma_dev_package.keys()
|
||||
when:
|
||||
- ansible_python_version.split('.')[0] == '2'
|
||||
- ansible_os_family != 'Darwin'
|
||||
|
||||
- name: Install prerequisites for backports.lzma when using python2 (OSX)
|
||||
block:
|
||||
- name: Find brew binary
|
||||
command: which brew
|
||||
register: brew_which
|
||||
- name: Get owner of brew binary
|
||||
stat: path="{{ brew_which.stdout }}"
|
||||
register: brew_stat
|
||||
- name: "Install package"
|
||||
homebrew:
|
||||
name: xz
|
||||
state: present
|
||||
update_homebrew: no
|
||||
become: yes
|
||||
become_user: "{{ brew_stat.stat.pw_name }}"
|
||||
# Newer versions of brew want to compile a package which takes a long time. Do not upgrade homebrew until a
|
||||
# proper solution can be found
|
||||
environment:
|
||||
HOMEBREW_NO_AUTO_UPDATE: True
|
||||
when:
|
||||
- ansible_python_version.split('.')[0] == '2'
|
||||
- ansible_os_family == 'Darwin'
|
||||
|
||||
- name: Ensure backports.lzma is present to create test archive (pip)
|
||||
pip: name=backports.lzma state=latest
|
||||
when: ansible_python_version.split('.')[0] == '2'
|
||||
register: backports_lzma_pip
|
||||
|
||||
- name: prep our files
|
||||
copy: src={{ item }} dest={{output_dir}}/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
- empty.txt
|
||||
|
||||
- name: archive using gz
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.gz"
|
||||
format: gz
|
||||
register: archive_gz_result_01
|
||||
|
||||
- debug: msg="{{ archive_gz_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files
|
||||
assert:
|
||||
that:
|
||||
- "{{ archive_gz_result_01.changed }}"
|
||||
- "{{ 'archived' in archive_gz_result_01 }}"
|
||||
- "{{ archive_gz_result_01['archived'] | length }} == 3"
|
||||
|
||||
- name: archive using zip
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.zip"
|
||||
format: zip
|
||||
register: archive_zip_result_01
|
||||
|
||||
- debug: msg="{{ archive_zip_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.zip state=file
|
||||
|
||||
- name: check if zip file exists
|
||||
assert:
|
||||
that:
|
||||
- "{{ archive_zip_result_01.changed }}"
|
||||
- "{{ 'archived' in archive_zip_result_01 }}"
|
||||
- "{{ archive_zip_result_01['archived'] | length }} == 3"
|
||||
|
||||
- name: archive using bz2
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.bz2"
|
||||
format: bz2
|
||||
register: archive_bz2_result_01
|
||||
|
||||
- debug: msg="{{ archive_bz2_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.bz2 state=file
|
||||
|
||||
- name: check if bzip file exists
|
||||
assert:
|
||||
that:
|
||||
- "{{ archive_bz2_result_01.changed }}"
|
||||
- "{{ 'archived' in archive_bz2_result_01 }}"
|
||||
- "{{ archive_bz2_result_01['archived'] | length }} == 3"
|
||||
|
||||
- name: archive using xz
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.xz"
|
||||
format: xz
|
||||
register: archive_xz_result_01
|
||||
|
||||
- debug: msg="{{ archive_xz_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.xz state=file
|
||||
|
||||
- name: check if xz file exists
|
||||
assert:
|
||||
that:
|
||||
- "{{ archive_xz_result_01.changed }}"
|
||||
- "{{ 'archived' in archive_xz_result_01 }}"
|
||||
- "{{ archive_xz_result_01['archived'] | length }} == 3"
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.gz"
|
||||
format: gz
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_bz2_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.gz"
|
||||
register: archive_02_gz_stat
|
||||
|
||||
- debug: msg="{{ archive_02_gz_stat}}"
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_gz_stat.changed == False "
|
||||
- "archive_02_gz_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_bz2_result_02"
|
||||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_02.gz" state=absent
|
||||
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.zip"
|
||||
format: zip
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_zip_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.zip"
|
||||
register: archive_02_zip_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_zip_stat.changed == False"
|
||||
- "archive_02_zip_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_zip_result_02"
|
||||
- "{{ archive_zip_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our zip
|
||||
file: path="{{ output_dir }}/archive_02.zip" state=absent
|
||||
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.bz2"
|
||||
format: bz2
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_bz2_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.bz2"
|
||||
register: archive_02_bz2_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_bz2_stat.changed == False"
|
||||
- "archive_02_bz2_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_bz2_result_02"
|
||||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our bz2
|
||||
file: path="{{ output_dir }}/archive_02.bz2" state=absent
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.xz"
|
||||
format: xz
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_xz_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.xz"
|
||||
register: archive_02_xz_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_xz_stat.changed == False"
|
||||
- "archive_02_xz_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_xz_result_02"
|
||||
- "{{ archive_xz_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our xz
|
||||
file: path="{{ output_dir }}/archive_02.xz" state=absent
|
||||
|
||||
- name: test that gz archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
format: gz
|
||||
register: nonascii_result_0
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
register: nonascii_stat0
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_0.changed == true"
|
||||
- "nonascii_stat0.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz" state=absent
|
||||
|
||||
- name: test that bz2 archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
format: bz2
|
||||
register: nonascii_result_1
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
register: nonascii_stat_1
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_1.changed == true"
|
||||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.bz2" state=absent
|
||||
|
||||
- name: test that xz archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
format: xz
|
||||
register: nonascii_result_1
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
register: nonascii_stat_1
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_1.changed == true"
|
||||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.xz" state=absent
|
||||
|
||||
- name: test that zip archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
format: zip
|
||||
register: nonascii_result_2
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
register: nonascii_stat_2
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_2.changed == true"
|
||||
- "nonascii_stat_2.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.zip" state=absent
|
||||
|
||||
- name: Remove backports.lzma if previously installed (pip)
|
||||
pip: name=backports.lzma state=absent
|
||||
when: backports_lzma_pip is changed
|
1
tests/integration/targets/callback_log_plays/aliases
Normal file
1
tests/integration/targets/callback_log_plays/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
shippable/posix/group3
|
|
@ -0,0 +1,4 @@
|
|||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- ping:
|
16
tests/integration/targets/callback_log_plays/runme.sh
Executable file
16
tests/integration/targets/callback_log_plays/runme.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
export ANSIBLE_CALLBACK_WHITELIST="log_plays,${ANSIBLE_CALLBACK_WHITELIST:-}"
|
||||
|
||||
# run play, should create log and dir if needed
|
||||
export ANSIBLE_LOG_FOLDER="logit"
|
||||
ansible-playbook ping_log.yml -v "$@"
|
||||
[[ -f "${ANSIBLE_LOG_FOLDER}/localhost" ]]
|
||||
|
||||
# now force it to fail
|
||||
export ANSIBLE_LOG_FOLDER="logit.file"
|
||||
touch "${ANSIBLE_LOG_FOLDER}"
|
||||
ansible-playbook ping_log.yml -v "$@" 2>&1| grep 'Failure using method (v2_runner_on_ok) in callback plugin'
|
||||
[[ ! -f "${ANSIBLE_LOG_FOLDER}/localhost" ]]
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_instance merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
- name: berfore merged, there should be no isis 100.
|
||||
ce_is_is_instance: &delete
|
||||
instance_id: 100
|
||||
state: absent
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_is_is_instance: &merged
|
||||
instance_id: 100
|
||||
vpn_name: '__public__'
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId></instanceId>
|
||||
<vpnName></vpnName>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<vpnName>__public__</vpnName>' in result_xml.end_state.result"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_instance: *merged
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- name: delete the provided configuration with the exisiting running configuration
|
||||
ce_is_is_instance: *delete
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId></instanceId>
|
||||
<vpnName></vpnName>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "'<vpnName>__public__</vpnName>' not in result_xml.end_state.result"
|
||||
|
||||
- name: delete the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_instance: *delete
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
|
||||
- debug:
|
||||
msg: "END ce_is_is_instance merged integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,133 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_interface merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_is_is_interface: &delete
|
||||
instance_id: 100
|
||||
ifname: 10GE1/0/1
|
||||
leveltype: level_1
|
||||
level1dispriority: 10
|
||||
silentenable: true
|
||||
silentcost: true
|
||||
typep2penable: true
|
||||
snpacheck: true
|
||||
p2pnegotiationmode: 2_way
|
||||
p2ppeeripignore: true
|
||||
ppposicpcheckenable: true
|
||||
level2cost: 10
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_is_is_interface: &merged
|
||||
instance_id: 100
|
||||
ifname: 10GE1/0/1
|
||||
leveltype: level_1
|
||||
level1dispriority: 10
|
||||
silentenable: true
|
||||
silentcost: true
|
||||
typep2penable: true
|
||||
snpacheck: true
|
||||
p2pnegotiationmode: 2_way
|
||||
p2ppeeripignore: true
|
||||
ppposicpcheckenable: true
|
||||
level2cost: 10
|
||||
register: result
|
||||
|
||||
- name: use ce_netconf to get configuration
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isCircuits>
|
||||
<isCircuit>
|
||||
</isCircuit>
|
||||
</isCircuits>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "'<ifName>10GE1/0/1</ifName>' in result_xml.end_state.result"
|
||||
- "'<circuitLevelType>level_1</circuitLevelType>' in result_xml.end_state.result"
|
||||
- "'<level1DisPriority>10</level1DisPriority>' in result_xml.end_state.result"
|
||||
- "'<level2DisPriority>10</level2DisPriority>' in result_xml.end_state.result"
|
||||
- "'<silentEnable>true</silentEnable>' in result_xml.end_state.result"
|
||||
- "'<silentCost>true</silentCost>' in result_xml.end_state.result"
|
||||
- "'<typeP2pEnable>true</typeP2pEnable>' in result_xml.end_state.result"
|
||||
- "'<snpaCheck>true</snpaCheck>' in result_xml.end_state.result"
|
||||
- "'<p2pNegotiationMode>2_way</p2pNegotiationMode>' in result_xml.end_state.result"
|
||||
- "'<p2pPeerIPIgnore>true</p2pPeerIPIgnore>' in result_xml.end_state.result"
|
||||
- "'<pPPOsicpCheckEnable>true</pPPOsicpCheckEnable>' in result_xml.end_state.result"
|
||||
- "'<level1Cost>10</level1Cost>' in result_xml.end_state.result"
|
||||
- "'<level2Cost>10</level2Cost>' in result_xml.end_state.result"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_interface: *merged
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- name: delete the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_interface: *delete
|
||||
register: result
|
||||
|
||||
- name: use ce_netconf to get configuration
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isCircuits>
|
||||
<isCircuit>
|
||||
</isCircuit>
|
||||
</isCircuits>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "'<ifName>10GE1/0/1</ifName>' not in result_xml.end_state.result"
|
||||
- "'<circuitLevelType>level_1</circuitLevelType>' not in result_xml.end_state.result"
|
||||
- "'<level1DisPriority>10</level1DisPriority>' not in result_xml.end_state.result"
|
||||
- "'<level2DisPriority>10</level2DisPriority>' not in result_xml.end_state.result"
|
||||
- "'<silentEnable>true</silentEnable>' not in result_xml.end_state.result"
|
||||
- "'<silentCost>true</silentCost>' not in result_xml.end_state.result"
|
||||
- "'<typeP2pEnable>true</typeP2pEnable>' not in result_xml.end_state.result"
|
||||
- "'<snpaCheck>true</snpaCheck>' not in result_xml.end_state.result"
|
||||
- "'<p2pNegotiationMode>2_way</p2pNegotiationMode>' not in result_xml.end_state.result"
|
||||
- "'<p2pPeerIPIgnore>true</p2pPeerIPIgnore>' not in result_xml.end_state.result"
|
||||
- "'<pPPOsicpCheckEnable>true</pPPOsicpCheckEnable>' not in result_xml.end_state.result"
|
||||
- "'<level1Cost>10</level1Cost>' not in result_xml.end_state.result"
|
||||
- "'<level2Cost>10</level2Cost>' not in result_xml.end_state.result"
|
||||
|
||||
- name: delete the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_is_is_interface: *delete
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was REPEAT
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_is_is_interface merged integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
2
tests/integration/targets/ce_is_is_view/tasks/main.yaml
Normal file
2
tests/integration/targets/ce_is_is_view/tasks/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
17
tests/integration/targets/ce_is_is_view/tasks/netconf.yaml
Normal file
17
tests/integration/targets/ce_is_is_view/tasks/netconf.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "CLEANUP ce_is_is_view, deleted integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<config>
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite operation=\"delete\">
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</config>"
|
||||
|
||||
- debug:
|
||||
msg: "END CLEANUP ce_is_is_view, deleted integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "SETUP ce_is_is_view integration tests on connection={{ ansible_connection }}"
|
||||
# create ISIS 100
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<config>
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite operation=\"merg\">
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</config>"
|
||||
|
||||
- debug:
|
||||
msg: "END SETUP ce_is_is_view integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,78 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view entity presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
netentity: isis_net_entity
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isNetEntitys>
|
||||
<isNetEntity>
|
||||
<netEntity></netEntity>
|
||||
</isNetEntity>
|
||||
</isNetEntitys>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<netEntity>isis_net_entity</netEntity>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
netentity: isis_net_entity
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "''<netEntity>isis_net_entity</netEntity>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view pentity resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
bfd_min_rx: 100
|
||||
bfd_min_tx: 100
|
||||
bfd_multiplier_num: 10
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<bfdMinRx></bfdMinRx>
|
||||
<bfdMinTx></bfdMinTx>
|
||||
<bfdMultNum></bfdMultNum>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<bfdMinRx>100</bfdMinRx>' in result_xml.end_state.result"
|
||||
- "'<bfdMinTx>100</bfdMinTx>' in result_xml.end_state.result"
|
||||
- "'<bfdMultNum>10</bfdMultNum>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<bfdMinRx>100</bfdMinRx>' not in result_xml.end_state.result"
|
||||
- "'<bfdMinTx>100</bfdMinTx>' not in result_xml.end_state.result"
|
||||
- "'<bfdMultNum>10</bfdMultNum>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
export_protocol: ospf
|
||||
export_policytype: aclNumOrName
|
||||
export_processid: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isFilterExports>
|
||||
<isFilterExport>
|
||||
<protocol></protocol>
|
||||
<processId></processId>
|
||||
<policyType></policyType>
|
||||
</isFilterExport>
|
||||
</isFilterExports>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' not in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' not in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,124 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
protocol: ospf
|
||||
processid: 100
|
||||
cost_type: external
|
||||
import_cost: 10
|
||||
import_tag: 10
|
||||
import_route_policy: routepolicy_name
|
||||
impotr_leveltype: level_1
|
||||
inheritcost: true
|
||||
permitibgp: true
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isImportRoutes>
|
||||
<isImportRoute>
|
||||
<protocol></protocol>
|
||||
<processId></processId>
|
||||
<costType></costType>
|
||||
<cost></cost>
|
||||
<tag></tag>
|
||||
<policyType></policyType>
|
||||
<routePolicyName></routePolicyName>
|
||||
<levelType></levelType>
|
||||
<inheritCost></inheritCost>
|
||||
<permitIbgp></permitIbgp>
|
||||
</isImportRoute>
|
||||
</isImportRoutes>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' in result_xml.end_state.result"
|
||||
- "'<costType>external</costType>' in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' in result_xml.end_state.result"
|
||||
- "'<inheritCost>true</inheritCost>' in result_xml.end_state.result"
|
||||
- "'<permitIbgp>true</permitIbgp>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' not in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' not in result_xml.end_state.result"
|
||||
- "'<costType>external</costType>' not in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' not in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' not in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' not in result_xml.end_state.result"
|
||||
- "'<inheritCost>true</inheritCost>' not in result_xml.end_state.result"
|
||||
- "'<permitIbgp>true</permitIbgp>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
penetration_direct: level1-level2
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel2ToLevel1>
|
||||
<tag></tag>
|
||||
<routePolicyName></routePolicyName>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<allowFilter></allowFilter>
|
||||
<allowUpdown></allowUpdown>
|
||||
</isLeakRouteLevel2ToLevel1>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
penetration_direct: level1-level2
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' not in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
penetration_direct: level2-level1
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel1ToLevel2s>
|
||||
<tag></tag>
|
||||
<routePolicyName></routePolicyName>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<allowFilter></allowFilter>
|
||||
<allowUpdown></allowUpdown>
|
||||
</isLeakRouteLevel1ToLevel2s>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
penetration_direct: level2-level1
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' not in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,80 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view maxLoadBalancing presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
max_load: 30
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<maxLoadBalancing></maxLoadBalancing>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<maxLoadBalancing>30</maxLoadBalancing>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
max_load: 30
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "'<maxLoadBalancing>30</maxLoadBalancing>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view maxLoadBalancing resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view preferences presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
preference_value: 100
|
||||
route_policy_name: route
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<isPreferences>
|
||||
<isPreference>
|
||||
<preferenceValue></preferenceValue>
|
||||
<routePolicyName></routePolicyName>
|
||||
</isPreference>
|
||||
</isPreferences>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<preferenceValue>100</preferenceValue>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>route</routePolicyName>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
preference_value: 100
|
||||
route_policy_name: route
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "''<preferenceValue>100</preferenceValue>' not in result_xml.end_state.result"
|
||||
- "''<routePolicyName>route</routePolicyName>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view Preference resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,115 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
description: ISIS
|
||||
islevel: level_1
|
||||
coststyle: narrow
|
||||
relaxSpfLimit: true
|
||||
stdlevel1cost: 60
|
||||
stdlevel2cost: 60
|
||||
stdbandwidth: 100
|
||||
autocostenable: true
|
||||
autocostenablecompatible: true
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<description></description>
|
||||
<isLevel></isLevel>
|
||||
<costStyle></costStyle>
|
||||
<relaxSpfLimit></relaxSpfLimit>
|
||||
<stdLevel1Cost></stdLevel1Cost>
|
||||
<stdLevel2Cost></stdLevel2Cost>
|
||||
<stdbandwidth></stdbandwidth>
|
||||
<stdAutoCostEnable></stdAutoCostEnable>
|
||||
<stdAutoCostEnableCompatible></stdAutoCostEnableCompatible>
|
||||
</isSite>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<vpnName>_public_</vpnName>' in result_xml.end_state.result"
|
||||
- "'<description>ISIS</description>' in result_xml.end_state.result"
|
||||
- "'<isLevel>level_1</isLevel>' in result_xml.end_state.result"
|
||||
- "'<costStyle>narrow</costStyle>' in result_xml.end_state.result"
|
||||
- "'<relaxSpfLimit>true</relaxSpfLimit>' in result_xml.end_state.result"
|
||||
- "'<stdLevel1Cost>60</stdLevel1Cost>' in result_xml.end_state.result"
|
||||
- "'<stdLevel2Cost>60</stdLevel2Cost>' in result_xml.end_state.result"
|
||||
- "'<stdbandwidth>100</stdbandwidth>' in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnable>true</stdAutoCostEnable>' in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
description: ISIS
|
||||
islevel: level_1
|
||||
coststyle: narrow
|
||||
relaxSpfLimit: true
|
||||
stdlevel1cost: 60
|
||||
stdlevel2cost: 60
|
||||
stdbandwidth: 100
|
||||
autocostenable: true
|
||||
autocostenablecompatible: true
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "'<vpnName>_public_</vpnName>' not in result_xml.end_state.result"
|
||||
- "'<description>ISIS</description>' not in result_xml.end_state.result"
|
||||
- "'<isLevel>level_1</isLevel>' not in result_xml.end_state.result"
|
||||
- "'<costStyle>narrow</costStyle>' not in result_xml.end_state.result"
|
||||
- "'<relaxSpfLimit>true</relaxSpfLimit>' not in result_xml.end_state.result"
|
||||
- "'<stdLevel1Cost>60</stdLevel1Cost>' not in result_xml.end_state.result"
|
||||
- "'<stdLevel2Cost>60</stdLevel2Cost>' not in result_xml.end_state.result"
|
||||
- "'<stdbandwidth>100</stdbandwidth>' not in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnable>true</stdAutoCostEnable>' not in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view presentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isDefaultRoutes>
|
||||
<isDefaultRoute>
|
||||
<defaultMode></defaultMode>
|
||||
<routePolicyName></routePolicyName>
|
||||
<cost></cost>
|
||||
<tag></tag>
|
||||
<levelType></levelType>
|
||||
<avoidLearning></avoidLearning>
|
||||
</isDefaultRoute>
|
||||
</isDefaultRoutes>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<defaultMode>always</defaultMode>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' in result_xml.end_state.result"
|
||||
- "'<avoidLearning>true</avoidLearning>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' not in result_xml.end_state.result"
|
||||
- "'<defaultMode>always</defaultMode>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' not in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' not in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' not in result_xml.end_state.result"
|
||||
- "'<avoidLearning>true</avoidLearning>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
import_aclnumorname: 301
|
||||
import_ipprefix: ipprefix
|
||||
import_routepolicyname: routepolicyname
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isFilterImports>
|
||||
<isFilterImport>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<routePolicyName></routePolicyName>
|
||||
</isFilterImport>
|
||||
</isFilterImports>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>ipprefix</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicyname</routePolicyName>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>ipprefix</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicyname</routePolicyName>' not in result_xml.end_state.result"
|
||||
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view next hop presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
ip_address: 1.1.1.1
|
||||
weight: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isNextHopWeights>
|
||||
<isNextHopWeight>
|
||||
<ipAddress></ipAddress>
|
||||
<weight></weight>
|
||||
</isNextHopWeight>
|
||||
</isNextHopWeights>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<ipAddress>1.1.1.1</ipAddress>' in result_xml.end_state.result"
|
||||
- "'<weight>100</weight>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
ip_address: 1.1.1.1
|
||||
weight: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<ipAddress>1.1.1.1</ipAddress>' not in result_xml.end_state.result"
|
||||
- "'<weight>100</weight>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view next hop resentd integration tests on connection={{ ansible_connection }}"
|
3
tests/integration/targets/ce_lacp/defaults/main.yaml
Normal file
3
tests/integration/targets/ce_lacp/defaults/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
2
tests/integration/targets/ce_lacp/tasks/main.yaml
Normal file
2
tests/integration/targets/ce_lacp/tasks/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
17
tests/integration/targets/ce_lacp/tasks/netconf.yaml
Normal file
17
tests/integration/targets/ce_lacp/tasks/netconf.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
95
tests/integration/targets/ce_lacp/tests/netconf/absent.yaml
Normal file
95
tests/integration/targets/ce_lacp/tests/netconf/absent.yaml
Normal file
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lacp merged integration tests on connection={{ ansible_connection }}"
|
||||
# befor removing, it should be merged
|
||||
- include_tasks: merge.yaml
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_lacp: &absent
|
||||
mode: Dynamic
|
||||
trunk_id: 10
|
||||
preempt_enable: True
|
||||
state_flapping: True
|
||||
port_id_extension_enable: True
|
||||
unexpected_mac_disable: True
|
||||
system_id: 1111-2222-3333
|
||||
timeout_type: Fast
|
||||
fast_timeout: 12
|
||||
mixed_rate_link_enable: True
|
||||
preempt_delay: 12
|
||||
collector_delay: 12
|
||||
max_active_linknumber: 2
|
||||
select: Prority
|
||||
priority: 23
|
||||
global_priority: 123
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<TrunkIfs>
|
||||
<TrunkIf>
|
||||
<ifName>Eth-Trunk10</ifName>
|
||||
<lacpTrunk>
|
||||
<isSupportPrmpt></isSupportPrmpt>
|
||||
<rcvTimeoutType></rcvTimeoutType>
|
||||
<fastTimeoutUserDefinedValue></fastTimeoutUserDefinedValue>
|
||||
<selectPortStd></selectPortStd>
|
||||
<promptDelay></promptDelay>
|
||||
<maxActiveNum></maxActiveNum>
|
||||
<collectMaxDelay></collectMaxDelay>
|
||||
<mixRateEnable></mixRateEnable>
|
||||
<dampStaFlapEn></dampStaFlapEn>
|
||||
<dampUnexpMacEn></dampUnexpMacEn>
|
||||
<trunkSysMac></trunkSysMac>
|
||||
<trunkPortIdExt></trunkPortIdExt>
|
||||
</lacpTrunk>
|
||||
</TrunkIf>
|
||||
</TrunkIfs>
|
||||
</ifmtrunk>
|
||||
</filter>"
|
||||
register: result_ifs_merged
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lacpSysInfo>
|
||||
<priority></priority>
|
||||
</lacpSysInfo>
|
||||
</ifmtrunk>
|
||||
</filter>"
|
||||
register: result_global_merged
|
||||
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lacp: *absent
|
||||
register: result_re_merged
|
||||
|
||||
- name: Assert that the previous task was idempotent, some become ot default values, others depend on devices.
|
||||
assert:
|
||||
that:
|
||||
- "result_re_merged.changed == false"
|
||||
- "'<isSupportPrmpt>false</isSupportPrmpt>' == result_ifs_merged.end_state.result"
|
||||
- "'<rcvTimeoutType>Slow</rcvTimeoutType>' == result_ifs_merged.end_state.result"
|
||||
- "'<fastTimeoutUserDefinedValue>90</fastTimeoutUserDefinedValue>' == result_ifs_merged.end_state.result"
|
||||
- "'<selectPortStd>Prority</selectPortStd>' == result_ifs_merged.end_state.result"
|
||||
- "'<promptDelay>30</promptDelay>' == result_ifs_merged.end_state.result"
|
||||
- "'<collectMaxDelay>0</collectMaxDelay>' in result_ifs_merged.end_state.result"
|
||||
- "'<mixRateEnable>false</mixRateEnable>' in result_ifs_merged.end_state.result"
|
||||
- "'<dampStaFlapEn>false</dampStaFlapEn>' in result_ifs_merged.end_state.result"
|
||||
- "'<dampUnexpMacEn>false</dampUnexpMacEn>' in result_ifs_merged.end_state.result"
|
||||
- "'<trunkSysMac>false</trunkSysMac>' in result_ifs_merged.end_state.result"
|
||||
- "'<priority>32768</priority>' in result_global_merged.end_state.result"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lacp merged integration tests on connection={{ ansible_connection }}"
|
32
tests/integration/targets/ce_lacp/tests/netconf/delete.yaml
Normal file
32
tests/integration/targets/ce_lacp/tests/netconf/delete.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lacp deleted integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_lacp:
|
||||
mode: Dynamic
|
||||
trunk_id: 10
|
||||
preempt_enable: True
|
||||
state_flapping: True
|
||||
port_id_extension_enable: True
|
||||
unexpected_mac_disable: True
|
||||
system_id: 1111-2222-3333
|
||||
timeout_type: Fast
|
||||
fast_timeout: 12
|
||||
mixed_rate_link_enable: True
|
||||
preempt_delay: 12
|
||||
collector_delay: 12
|
||||
max_active_linknumber: 2
|
||||
select: Prority
|
||||
priority: 23
|
||||
global_priority: 123
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lacp deleted integration tests on connection={{ ansible_connection }}"
|
31
tests/integration/targets/ce_lacp/tests/netconf/merge.yaml
Normal file
31
tests/integration/targets/ce_lacp/tests/netconf/merge.yaml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lacp merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_lacp:
|
||||
mode: Dynamic
|
||||
trunk_id: 10
|
||||
preempt_enable: True
|
||||
state_flapping: True
|
||||
port_id_extension_enable: True
|
||||
unexpected_mac_disable: True
|
||||
system_id: 1111-2222-3333
|
||||
timeout_type: Fast
|
||||
fast_timeout: 12
|
||||
mixed_rate_link_enable: True
|
||||
preempt_delay: 12
|
||||
collector_delay: 12
|
||||
max_active_linknumber: 2
|
||||
select: Prority
|
||||
priority: 23
|
||||
global_priority: 123
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lacp merged integration tests on connection={{ ansible_connection }}"
|
103
tests/integration/targets/ce_lacp/tests/netconf/present.yaml
Normal file
103
tests/integration/targets/ce_lacp/tests/netconf/present.yaml
Normal file
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lacp presented integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_lacp: &present
|
||||
mode: Dynamic
|
||||
trunk_id: 10
|
||||
preempt_enable: True
|
||||
state_flapping: True
|
||||
port_id_extension_enable: True
|
||||
unexpected_mac_disable: True
|
||||
system_id: 1111-2222-3333
|
||||
timeout_type: Fast
|
||||
fast_timeout: 12
|
||||
mixed_rate_link_enable: True
|
||||
preempt_delay: 12
|
||||
collector_delay: 12
|
||||
max_active_linknumber: 2
|
||||
select: Prority
|
||||
priority: 23
|
||||
global_priority: 123
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<TrunkIfs>
|
||||
<TrunkIf>
|
||||
<ifName>Eth-Trunk10</ifName>
|
||||
<workMode></workMode>
|
||||
<lacpTrunk>
|
||||
<isSupportPrmpt></isSupportPrmpt>
|
||||
<rcvTimeoutType></rcvTimeoutType>
|
||||
<fastTimeoutUserDefinedValue></fastTimeoutUserDefinedValue>
|
||||
<selectPortStd></selectPortStd>
|
||||
<promptDelay></promptDelay>
|
||||
<maxActiveNum></maxActiveNum>
|
||||
<collectMaxDelay></collectMaxDelay>
|
||||
<mixRateEnable></mixRateEnable>
|
||||
<dampStaFlapEn></dampStaFlapEn>
|
||||
<dampUnexpMacEn></dampUnexpMacEn>
|
||||
<trunkSysMac></trunkSysMac>
|
||||
<trunkPortIdExt></trunkPortIdExt>
|
||||
</lacpTrunk>
|
||||
</TrunkIf>
|
||||
</TrunkIfs>
|
||||
</ifmtrunk>
|
||||
</filter>"
|
||||
register: result_ifs_presentd
|
||||
|
||||
- name: Get global lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lacpSysInfo>
|
||||
<priority></priority>
|
||||
<lacpMlagGlobal>
|
||||
<lacpMlagPriority></lacpMlagPriority>
|
||||
<lacpMlagSysId></lacpMlagSysId>
|
||||
</lacpMlagGlobal>
|
||||
</lacpSysInfo>
|
||||
</ifmtrunk>
|
||||
</filter>"
|
||||
register: result_global_presentd
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lacp: *present
|
||||
register: result_re_presentd
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result_re_presentd.changed == false"
|
||||
- "'<workMode>Dynamic</workMode>' == result_ifs_presentd.end_state.result"
|
||||
- "'<isSupportPrmpt>true</isSupportPrmpt>' == result_ifs_presentd.end_state.result"
|
||||
- "'<rcvTimeoutType>Fast</rcvTimeoutType>' == result_ifs_presentd.end_state.result"
|
||||
- "'<fastTimeoutUserDefinedValue>12</fastTimeoutUserDefinedValue>' == result_ifs_presentd.end_state.result"
|
||||
- "'<selectPortStd>Prority</selectPortStd>' == result_ifs_presentd.end_state.result"
|
||||
- "'<promptDelay>12</promptDelay>' == result_ifs_presentd.end_state.result"
|
||||
- "'<maxActiveNum>2</maxActiveNum>' == result_ifs_presentd.end_state.result"
|
||||
- "'<collectMaxDelay>12</collectMaxDelay>' in result_ifs_presentd.end_state.result"
|
||||
- "'<mixRateEnable>true</mixRateEnable>' in result_ifs_presentd.end_state.result"
|
||||
- "'<dampStaFlapEn>true</dampStaFlapEn>' in result_ifs_presentd.end_state.result"
|
||||
- "'<dampUnexpMacEn>true</dampUnexpMacEn>' in result_ifs_presentd.end_state.result"
|
||||
- "'<trunkSysMac>true</trunkSysMac>' in result_ifs_presentd.end_state.result"
|
||||
- "'<trunkPortIdExt>true</trunkPortIdExt>' in result_ifs_presentd.end_state.result"
|
||||
- "'<lacpMlagSysId>1111-2222-3333</lacpMlagSysId>' in result_global_presentd.end_state.result"
|
||||
- "'<priority>123</priority>' in result_global_presentd.end_state.result"
|
||||
|
||||
# after present, it should be deleted
|
||||
- include_tasks: delete.yaml
|
||||
- debug:
|
||||
msg: "END ce_lacp presentd integration tests on connection={{ ansible_connection }}"
|
3
tests/integration/targets/ce_lldp/defaults/main.yaml
Normal file
3
tests/integration/targets/ce_lldp/defaults/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
1
tests/integration/targets/ce_lldp/meta/main.yml
Normal file
1
tests/integration/targets/ce_lldp/meta/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
|
2
tests/integration/targets/ce_lldp/tasks/main.yaml
Normal file
2
tests/integration/targets/ce_lldp/tasks/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
17
tests/integration/targets/ce_lldp/tasks/netconf.yaml
Normal file
17
tests/integration/targets/ce_lldp/tasks/netconf.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
108
tests/integration/targets/ce_lldp/tests/netconf/absent.yaml
Normal file
108
tests/integration/targets/ce_lldp/tests/netconf/absent.yaml
Normal file
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lldp absent integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
|
||||
- name: present the provided configuration befor absent
|
||||
ce_lldp:
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
# There should be some configuration(LLDP) on host befor absent
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "'lldp enable' in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' in result_display.stdout[0]"
|
||||
- "'lldp restart 3' in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' in result_display.stdout[0]"
|
||||
|
||||
- name: absent the provided configuration with the exisiting running configuration
|
||||
ce_lldp: &absent
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'lldp enable' not in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' not in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' not in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' not in result_display.stdout[0]"
|
||||
- "'lldp restart 3' not in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' not in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' not in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' not in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' not in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' not in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' not in result_display.stdout[0]"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lldp: *absent
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lldp absent integration tests on connection={{ ansible_connection }}"
|
20
tests/integration/targets/ce_lldp/tests/netconf/clean.yaml
Normal file
20
tests/integration/targets/ce_lldp/tests/netconf/clean.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "Start ce_lldp deleted remove interface config ansible_connection={{ ansible_connection }}"
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
# After the global LLDP function is disabled, all LLDP configuration restore defaults except the LLDP alarm function.
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- undo lldp enable
|
||||
- lldp mdn disable
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- debug:
|
||||
msg: "End ce_lldp deleted remove interface config ansible_connection={{ ansible_connection }}"
|
66
tests/integration/targets/ce_lldp/tests/netconf/present.yaml
Normal file
66
tests/integration/targets/ce_lldp/tests/netconf/present.yaml
Normal file
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lldp merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
|
||||
- include_tasks: cleanup.yaml
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_lldp: &merged
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
interval: 35
|
||||
hold_multiplier: 5
|
||||
restart_delay: 3
|
||||
transmit_delay: 5
|
||||
notification_interval: 6
|
||||
fast_count: 5
|
||||
mdn_notification_interval: 10.1.1.1
|
||||
management_address: 10.10.10.1
|
||||
bind_name: vlanif100
|
||||
register: result
|
||||
|
||||
- name: change ansible_connection to network_cli
|
||||
set_fact:
|
||||
ansible_connection: network_cli
|
||||
|
||||
- name: display lldp
|
||||
ce_command:
|
||||
commands:
|
||||
- display current-configuration | include lldp
|
||||
register: result_display
|
||||
|
||||
- name: change ansible_connection to netconf
|
||||
set_fact:
|
||||
ansible_connection: netconf
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- "'lldp enable' in result_display.stdout[0]"
|
||||
- "'undo lldp mdn disable' in result_display.stdout[0]"
|
||||
- "'lldp transmit interval 35' in result_display.stdout[0]"
|
||||
- "'lldp transmit multiplier 5' in result_display.stdout[0]"
|
||||
- "'lldp restart 3' in result_display.stdout[0]"
|
||||
- "'lldp transmit delay 5' in result_display.stdout[0]"
|
||||
- "'lldp fast-count 5' in result_display.stdout[0]"
|
||||
- "'lldp management-address 10.10.10.1' in result_display.stdout[0]"
|
||||
- "'lldp mdn trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp trap-interval 6' in result_display.stdout[0]"
|
||||
- "'lldp management-address bind interface vlanif100' in result_display.stdout[0]"
|
||||
|
||||
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_lldp: *merged
|
||||
register: result
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
|
||||
- include_tasks: cleanup.yaml
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lldp merged integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,155 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_lldp_interface merged integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- block:
|
||||
- name: Merge the provided configuration with the exisiting running configuration - basic-tlv
|
||||
ce_lldp_interface: &merged1
|
||||
config:
|
||||
msg_interval: 8
|
||||
ifname: 10GE 1/0/1
|
||||
admin_status: txandrx
|
||||
basic_tlv:
|
||||
management_addr: true
|
||||
port_desc: true
|
||||
system_capability: true
|
||||
system_description: true
|
||||
system_name: true
|
||||
register: result1
|
||||
- name: Merge the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_lldp_interface: *merged1
|
||||
register: result2
|
||||
- name: "Netconf get operation"
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: '<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lldpInterfaces>
|
||||
<lldpInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<msgInterval>
|
||||
<txInterval></txInterval>
|
||||
</msgInterval>
|
||||
<lldpAdminStatus></lldpAdminStatus>
|
||||
<tlvTxEnable>
|
||||
<manAddrTxEnable></manAddrTxEnable>
|
||||
<portDescTxEnable></portDescTxEnable>
|
||||
<sysCapTxEnable></sysCapTxEnable>
|
||||
</tlvTxEnable>
|
||||
</lldpInterface>
|
||||
</lldpInterfaces>
|
||||
</lldp>
|
||||
</filter>'
|
||||
register: result3
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
- "'<txInterval>8</txInterval>' in result3.endstate.result"
|
||||
- "'<lldpAdminStatus>txAndRx</lldpAdminStatus>' in result3.endstate.result"
|
||||
- "'<manAddrTxEnable>true</manAddrTxEnable>' in result3.endstate.result"
|
||||
- "'<portDescTxEnable>true</portDescTxEnable>' in result3.endstate.result"
|
||||
- "'<sysCapTxEnable>true</sysCapTxEnable>' in result3.endstate.result"
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration - dot1-tlv
|
||||
ce_lldp_interface: &merged2
|
||||
config:
|
||||
msg_interval: 8
|
||||
ifname: 10GE 1/0/1
|
||||
dot1_tlv:
|
||||
port_vlan_enable: true
|
||||
port_desc: true
|
||||
prot_vlan_enable: true
|
||||
prot_vlan_id: 123
|
||||
vlan_name: 234
|
||||
vlan_name_enable: true
|
||||
register: result1
|
||||
- name: Merge the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_lldp_interface: *merged2
|
||||
register: result2
|
||||
- name: "Netconf get operation"
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: '<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lldpInterfaces>
|
||||
<lldpInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<msgInterval>
|
||||
<txInterval></txInterval>
|
||||
</msgInterval>
|
||||
<lldpAdminStatus></lldpAdminStatus>
|
||||
<tlvTxEnable>
|
||||
<portVlanTxEnable></portVlanTxEnable>
|
||||
<protoVlanTxEnable></protoVlanTxEnable>
|
||||
<txProtocolVlanId></txProtocolVlanId>
|
||||
<vlanNameTxEnable></vlanNameTxEnable>
|
||||
<txVlanNameId></txVlanNameId>
|
||||
<protoIdTxEnable></protoIdTxEnable>
|
||||
</tlvTxEnable>
|
||||
</lldpInterface>
|
||||
</lldpInterfaces>
|
||||
</lldp>
|
||||
</filter>'
|
||||
register: result3
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
- "'<portVlanTxEnable>true</portVlanTxEnable>' in result3.endstate.result"
|
||||
- "'<protoVlanTxEnable>true</protoVlanTxEnable>' in result3.endstate.result"
|
||||
- "'<txProtocolVlanId>123</txProtocolVlanId>' in result3.endstate.result"
|
||||
- "'<vlanNameTxEnable>true</vlanNameTxEnable>' in result3.endstate.result"
|
||||
- "'<txVlanNameId>true</txVlanNameId>' in result3.endstate.result"
|
||||
- "'<protoIdTxEnable>true</protoIdTxEnable>' in result3.endstate.result"
|
||||
|
||||
- name: Merge the provided configuration with the exisiting running configuration - dot3-tlv
|
||||
ce_lldp_interface: &merged
|
||||
config:
|
||||
msg_interval: 8
|
||||
ifname: 10GE 1/0/1
|
||||
dot3_tlv:
|
||||
eee: true
|
||||
link_aggregation: true
|
||||
mac_physic: true
|
||||
max_frame_size: true
|
||||
register: result1
|
||||
- name: Merge the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_lldp_interface: *merged
|
||||
register: result2
|
||||
- name: "Netconf get operation"
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: '<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lldpInterfaces>
|
||||
<lldpInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<msgInterval>
|
||||
<txInterval></txInterval>
|
||||
</msgInterval>
|
||||
<lldpAdminStatus></lldpAdminStatus>
|
||||
<tlvTxEnable>
|
||||
<macPhyTxEnable></macPhyTxEnable>
|
||||
<linkAggreTxEnable></linkAggreTxEnable>
|
||||
<maxFrameTxEnable></maxFrameTxEnable>
|
||||
<eee></eee>
|
||||
</tlvTxEnable>
|
||||
</lldpInterface>
|
||||
</lldpInterfaces>
|
||||
</lldp>
|
||||
</filter>'
|
||||
register: result3
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
- "'<macPhyTxEnable>true</macPhyTxEnable>' in result3.endstate.result"
|
||||
- "'<linkAggreTxEnable>true</linkAggreTxEnable>' in result3.endstate.result"
|
||||
- "'<maxFrameTxEnable>123</maxFrameTxEnable>' in result3.endstate.result"
|
||||
|
||||
- debug:
|
||||
msg: "END ce_lldp_interface merged integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_mdn_interface presented integration tests on connection={{ ansible_connection }}"
|
||||
# set up default before test
|
||||
- name: clean up default configuration with the exisiting running configuration
|
||||
ce_mdn_interface:
|
||||
lldpenable: disabled
|
||||
mdnstatus: disabled
|
||||
ifname: 10GE1/0/1
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_mdn_interface: &present
|
||||
lldpenable: enabled
|
||||
mdnstatus: rxOnly
|
||||
ifname: 10GE1/0/1
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get mdnInterface config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<mdnInterfaces>
|
||||
<mdnInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<mdnStatus></mdnStatus>
|
||||
</mdnInterface>
|
||||
</mdnInterfaces>
|
||||
</lldp>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
- name: Get lldp enabled config by ce_netconf.
|
||||
ce_netconf: &get_config_lldp
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<lldp xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<lldpSys>
|
||||
<lldpEnable></lldpEnable>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
/filter>"
|
||||
register: result_xml_lldp
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_mdn_interface: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<mdnStatus>rxOnly</mdnStatus>' in result_xml.end_state.result"
|
||||
- "'<lldpEnable>enabled</lldpEnable>' in result_xml_lldp.end_state.result"
|
||||
|
||||
- name: absent the provided configuration with the exisiting running configuration
|
||||
ce_mdn_interface: &absent
|
||||
lldpenable: disabled
|
||||
mdnstatus: disabled
|
||||
ifname: 10GE1/0/1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: absent the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_mdn_interface: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get mdnInterface config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Get lldp enabled config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml_lldp
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
- "'<mdnStatus>disabled</mdnStatus>' not in result_xml.end_state.result"
|
||||
- "'<lldpEnable>disabled</lldpEnable>' in result_xml_lldp.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
|
||||
- debug:
|
||||
msg: "END ce_mdn_interface resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_multicast_global presented integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_multicast_global: &present
|
||||
aftype: v4
|
||||
vrf: vpna
|
||||
weight: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<mcastbase xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<mcastAfsEnables>
|
||||
<mcastAfsEnable>
|
||||
<vrfName></vrfName>
|
||||
<addressFamily></addressFamily>
|
||||
</mcastAfsEnable>
|
||||
</mcastAfsEnables>
|
||||
</mcastbase>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_multicast_global: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<vrfName>vpna</vrfName>' in result_xml.end_state.result"
|
||||
- "'<addressFamily>vpna</addressFamily>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_multicast_global: &absent
|
||||
aftype: v4
|
||||
vrf: vpna
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_multicast_global: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<vrfName>vpna</vrfName>' not in result_xml.end_state.result"
|
||||
- "'<addressFamily>vpna</addressFamily>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
|
||||
- debug:
|
||||
msg: "END ce_multicast_global resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_multicast_igmp_enable presented integration tests on connection={{ ansible_connection }}"
|
||||
# clean up before test
|
||||
- name: clean up configuration with the exisiting running configuration
|
||||
ce_multicast_igmp_enable: &absent
|
||||
aftype: v4
|
||||
features: vlan
|
||||
vlan_id: 100
|
||||
igmp: true
|
||||
version: 2
|
||||
proxy: true
|
||||
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_multicast_igmp_enable: &present
|
||||
aftype: v4
|
||||
features: vlan
|
||||
vlan_id: 100
|
||||
igmp: true
|
||||
version: 2
|
||||
proxy: true
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<l2mc xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<vlan>
|
||||
<l2McVlanCfgs>
|
||||
<l2McVlanCfg>
|
||||
<addrFamily></addrFamily>
|
||||
<vlanId></vlanId>
|
||||
<snoopingEnable></snoopingEnable>
|
||||
<version></version>
|
||||
<proxyEnable></proxyEnable>
|
||||
</l2McVlanCfg>
|
||||
</l2McVlanCfgs>
|
||||
</vlan>
|
||||
</l2mc>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_multicast_igmp_enable: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<addrFamily>ipv4unicast</addrFamily>' in result_xml.end_state.result"
|
||||
- "'<vlanId>100</vlanId>' in result_xml.end_state.result"
|
||||
- "'<snoopingEnable>true</snoopingEnable>' in result_xml.end_state.result"
|
||||
- "'<version>2</version>' in result_xml.end_state.result"
|
||||
- "'<proxyEnable>true</proxyEnable>' in result_xml.end_state.result"
|
||||
|
||||
- name: absent the provided configuration with the exisiting running configuration
|
||||
ce_multicast_igmp_enable: *absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: absent the provided configuration with the existing running configuration (REPEAT)
|
||||
ce_multicast_igmp_enable: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == false"
|
||||
- "'<addrFamily>ipv4unicast</addrFamily>' not in result_xml.end_state.result"
|
||||
- "'<vlanId>100</vlanId>' not in result_xml.end_state.result"
|
||||
- "'<snoopingEnable>true</snoopingEnable>' not in result_xml.end_state.result"
|
||||
- "'<version>2</version>' not in result_xml.end_state.result"
|
||||
- "'<proxyEnable>true</proxyEnable>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
|
||||
- debug:
|
||||
msg: "END ce_multicast_igmp_enable resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,150 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_static_route_bfd presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: cleanup.yaml
|
||||
- name: Config an ip route-static bfd 10GE1/0/1 3.3.3.3 min-rx-interval 50 min-tx-interval 50 detect-multiplier 5
|
||||
ce_static_route_bfd: &merge1
|
||||
function_flag: 'singleBFD'
|
||||
nhp_interface: 10GE1/0/1
|
||||
next_hop: 3.3.3.3
|
||||
min_tx_interval: 50
|
||||
min_rx_interval: 50
|
||||
detect_multiplier: 5
|
||||
aftype: v4
|
||||
state: present
|
||||
register: result1
|
||||
- name: (repeat)Config an ip route-static bfd 10GE1/0/1 3.3.3.3 min-rx-interval 50 min-tx-interval 50 detect-multiplier 5
|
||||
ce_static_route_bfd:
|
||||
<<: *merge1
|
||||
register: result2
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
|
||||
|
||||
# ip route-static bfd [ interface-type interface-number | vpn-instance vpn-instance-name ] nexthop-address
|
||||
- name: ip route-static bfd 10GE1/0/1 3.3.3.4
|
||||
ce_static_route_bfd: &merge2
|
||||
function_flag: 'singleBFD'
|
||||
nhp_interface: 10GE1/0/1
|
||||
next_hop: 3.3.3.4
|
||||
aftype: v4
|
||||
register: result1
|
||||
- name: (repeat)ip route-static bfd 10GE1/0/1 3.3.3.4
|
||||
ce_static_route_bfd:
|
||||
<<: *merge2
|
||||
register: result2
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
#ip route-static default-bfd { min-rx-interval {min-rx-interval} | min-tx-interval {min-tx-interval} | detect-multiplier {multiplier}}
|
||||
- name: Config an ip route-static default-bfd min-rx-interval 50 min-tx-interval 50 detect-multiplier 6
|
||||
ce_static_route_bfd: &merge3
|
||||
function_flag: 'globalBFD'
|
||||
min_tx_interval: 50
|
||||
min_rx_interval: 50
|
||||
detect_multiplier: 6
|
||||
aftype: v4
|
||||
state: present
|
||||
register: result1
|
||||
- name: (repeat)Config an ip route-static default-bfd min-rx-interval 50 min-tx-interval 50 detect-multiplier 6
|
||||
ce_static_route_bfd:
|
||||
<<: *merge3
|
||||
register: result2
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
|
||||
- name: undo ip route-static default-bfd
|
||||
ce_static_route_bfd: &merge4
|
||||
function_flag: 'globalBFD'
|
||||
aftype: v4
|
||||
state: absent
|
||||
commands: 'sys,undo ip route-static default-bfd,commit'
|
||||
register: result1
|
||||
- name: (repeat)undo ip route-static default-bfd
|
||||
ce_static_route_bfd:
|
||||
<<: *merge4
|
||||
register: result2
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
|
||||
- name: Config an ipv4 static route 2.2.2.0/24 2.2.2.1 preference 1 tag 2 description test for staticBFD
|
||||
ce_static_route_bfd: &merge5
|
||||
function_flag: 'staticBFD'
|
||||
prefix: 2.2.2.2
|
||||
mask: 24
|
||||
next_hop: 2.2.2.1
|
||||
tag: 2
|
||||
description: test
|
||||
pref: 1
|
||||
aftype: v4
|
||||
bfd_session_name: btoa
|
||||
state: present
|
||||
register: result1
|
||||
- name: (repeat) Config an ipv4 static route 2.2.2.0/24 2.2.2.1 preference 1 tag 2 description test for staticBFD
|
||||
ce_static_route_bfd:
|
||||
<<: *merge5
|
||||
register: result2
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result1['changed'] == true"
|
||||
- "result2['changed'] == false"
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<get>
|
||||
<filter type=\"subtree\">
|
||||
<staticrt xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<staticrtbase>
|
||||
<srBfdParas>
|
||||
<srBfdPara>
|
||||
<afType/>
|
||||
<ifName/>
|
||||
<destVrfName/>
|
||||
<nexthop/>
|
||||
<localAddress/>
|
||||
<minTxInterval/>
|
||||
<minRxInterval/>
|
||||
<multiplier/>
|
||||
</srBfdPara>
|
||||
</srBfdParas>
|
||||
</staticrtbase>
|
||||
</staticrt>
|
||||
</filter>
|
||||
</get>"
|
||||
register: result_present
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "'<afType>v4</afType>' == result_present.end_state.result"
|
||||
- "'<ifName>10GE1/0/1</ifName>' == result_present.end_state.result"
|
||||
- "'<rcvTimeoutType>Fast</rcvTimeoutType>' == result_present.end_state.result"
|
||||
- "'<destVrfName>__publiv__</destVrfName>' == result_present.end_state.result"
|
||||
- "'<selectPortStd>Prority</selectPortStd>' == result_present.end_state.result"
|
||||
- "'<nexthop>2.2.2.1</nexthop>' == result_present.end_state.result"
|
||||
- "'<localAddress>2.2.2.2</localAddress>' == result_present.end_state.result"
|
||||
- "'<minTxInterval>12</minTxInterval>' in result_present.end_state.result"
|
||||
- "'<mixRateEnable>true</mixRateEnable>' in result_present.end_state.result"
|
||||
- "'<multiplier>true</multiplier>' in result_present.end_state.result"
|
||||
- "'<dampUnexpMacEn>true</dampUnexpMacEn>' in result_present.end_state.result"
|
||||
- "'<trunkSysMac>true</trunkSysMac>' in result_present.end_state.result"
|
||||
- "'<trunkPortIdExt>true</trunkPortIdExt>' in result_present.end_state.result"
|
||||
- "'<lacpMlagSysId>1111-2222-3333</lacpMlagSysId>' in result_present.end_state.result"
|
||||
- "'<priority>123</priority>' in result_present.end_state.result"
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_static_route_bfd presentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: Merge the provided configuration with the exisiting running configuration
|
||||
ce_static_route_bfd:
|
||||
function_flag: 'singleBFD'
|
||||
nhp_interface: 10GE1/0/1
|
||||
next_hop: 3.3.3.3
|
||||
min_tx_interval: 50
|
||||
min_rx_interval: 50
|
||||
detect_multiplier: 5
|
||||
aftype: v4
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
- name: ip route-static bfd 10GE1/0/1 3.3.3.4
|
||||
ce_static_route_bfd: &merge
|
||||
function_flag: 'globalBFD'
|
||||
min_tx_interval: 50
|
||||
min_rx_interval: 50
|
||||
detect_multiplier: 6
|
||||
aftype: v4
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
5
tests/integration/targets/cloud_init_data_facts/aliases
Normal file
5
tests/integration/targets/cloud_init_data_facts/aliases
Normal file
|
@ -0,0 +1,5 @@
|
|||
destructive
|
||||
shippable/posix/group1
|
||||
skip/aix
|
||||
skip/osx
|
||||
skip/freebsd
|
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
- name: test cloud-init
|
||||
# TODO: check for a workaround
|
||||
# install 'cloud-init'' failed: dpkg-divert: error: `diversion of /etc/init/ureadahead.conf
|
||||
# to /etc/init/ureadahead.conf.disabled by cloud-init' clashes with `local diversion of
|
||||
# /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.distrib
|
||||
# https://bugs.launchpad.net/ubuntu/+source/ureadahead/+bug/997838
|
||||
# Will also have to skip on OpenSUSE when running on Python 2 on newer Leap versions
|
||||
# (!= 42 and >= 15) ascloud-init will install the Python 3 package, breaking our build on py2.
|
||||
when:
|
||||
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
|
||||
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3)
|
||||
block:
|
||||
- name: setup install cloud-init
|
||||
package:
|
||||
name:
|
||||
- cloud-init
|
||||
- udev
|
||||
|
||||
- name: setup run cloud-init
|
||||
service:
|
||||
name: cloud-init-local
|
||||
state: restarted
|
||||
|
||||
- name: test gather cloud-init facts in check mode
|
||||
cloud_init_data_facts:
|
||||
check_mode: yes
|
||||
register: result
|
||||
- name: verify test gather cloud-init facts in check mode
|
||||
assert:
|
||||
that:
|
||||
- result.cloud_init_data_facts.status.v1 is defined
|
||||
- result.cloud_init_data_facts.status.v1.stage is defined
|
||||
- not result.cloud_init_data_facts.status.v1.stage
|
||||
- cloud_init_data_facts.status.v1 is defined
|
||||
- cloud_init_data_facts.status.v1.stage is defined
|
||||
- not cloud_init_data_facts.status.v1.stage
|
||||
|
||||
- name: test gather cloud-init facts
|
||||
cloud_init_data_facts:
|
||||
register: result
|
||||
- name: verify test gather cloud-init facts
|
||||
assert:
|
||||
that:
|
||||
- result.cloud_init_data_facts.status.v1 is defined
|
||||
- result.cloud_init_data_facts.status.v1.stage is defined
|
||||
- not result.cloud_init_data_facts.status.v1.stage
|
||||
- cloud_init_data_facts.status.v1 is defined
|
||||
- cloud_init_data_facts.status.v1.stage is defined
|
||||
- not cloud_init_data_facts.status.v1.stage
|
1
tests/integration/targets/cloudscale_common/aliases
Normal file
1
tests/integration/targets/cloudscale_common/aliases
Normal file
|
@ -0,0 +1 @@
|
|||
hidden
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
# The image to use for test servers
|
||||
cloudscale_test_image: 'debian-9'
|
||||
|
||||
# Alternate test image to use if a different image is required
|
||||
cloudscale_alt_test_image: 'ubuntu-18.04'
|
||||
|
||||
# The flavor to use for test servers
|
||||
cloudscale_test_flavor: 'flex-2'
|
||||
|
||||
# SSH key to use for test servers
|
||||
cloudscale_test_ssh_key: |
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
|
||||
|
||||
# The zone to use to test servers
|
||||
cloudscale_test_zone: 'lpg1'
|
||||
|
||||
# The region to use to request floating IPs
|
||||
cloudscale_test_region: 'lpg'
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: List all floating IPs
|
||||
uri:
|
||||
url: 'https://api.cloudscale.ch/v1/floating-ips'
|
||||
headers:
|
||||
Authorization: 'Bearer {{ cloudscale_api_token }}'
|
||||
status_code: 200
|
||||
register: floating_ip_list
|
||||
|
||||
- name: Remove all floating IPs created by this test run
|
||||
cloudscale_floating_ip:
|
||||
ip: '{{ item.network | ipaddr("address") }}'
|
||||
state: 'absent'
|
||||
when: cloudscale_resource_prefix in (item.reverse_ptr | string )
|
||||
with_items: '{{ floating_ip_list.json }}'
|
||||
loop_control:
|
||||
label: '{{ item.reverse_ptr }} ({{ item.network }})'
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue