mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 03:53:59 -07:00
Add junos_banner declartive module (#25826)
* Add junos_banner declartive module * junos_banner implementation * Integration test for junos_banner * Integration test for net_banner (junos) * Minor fixes * Minor doc change
This commit is contained in:
parent
97e24dc317
commit
450263e934
20 changed files with 508 additions and 16 deletions
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
16
test/integration/targets/net_banner/tasks/netconf.yaml
Normal file
16
test/integration/targets/net_banner/tasks/netconf.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
delegate_to: localhost
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
91
test/integration/targets/net_banner/tests/junos/basic.yaml
Normal file
91
test/integration/targets/net_banner/tests/junos/basic.yaml
Normal file
|
@ -0,0 +1,91 @@
|
|||
---
|
||||
- debug: msg="START net_banner junos/basic.yaml"
|
||||
|
||||
- name: setup - remove login banner
|
||||
net_banner:
|
||||
banner: login
|
||||
state: absent
|
||||
provider: "{{ netconf }}"
|
||||
|
||||
- name: Create login banner
|
||||
net_banner:
|
||||
banner: login
|
||||
text: this is my login banner
|
||||
state: present
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message>this is my login banner</message>' in result.rpc"
|
||||
|
||||
- name: Create login banner (idempotent)
|
||||
net_banner:
|
||||
banner: login
|
||||
text: this is my login banner
|
||||
state: present
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: delete login banner
|
||||
net_banner:
|
||||
banner: login
|
||||
state: absent
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message delete=\"delete\" />' in result.rpc"
|
||||
|
||||
- name: setup - remove motd banner
|
||||
net_banner:
|
||||
banner: motd
|
||||
state: absent
|
||||
provider: "{{ netconf }}"
|
||||
|
||||
- name: Create motd banner
|
||||
junos_banner:
|
||||
banner: motd
|
||||
text: this is my motd banner
|
||||
state: present
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement>this is my motd banner</announcement>' in result.rpc"
|
||||
|
||||
- name: Create motd banner (idempotent)
|
||||
net_banner:
|
||||
banner: motd
|
||||
text: this is my motd banner
|
||||
state: present
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: delete motd banner
|
||||
junos_banner:
|
||||
banner: motd
|
||||
state: absent
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement delete=\"delete\" />' in result.rpc"
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- include: "{{ role_path }}/tests/junos/basic.yaml"
|
||||
when: hostvars[inventory_hostname]['ansible_network_os'] == 'junos'
|
Loading…
Add table
Add a link
Reference in a new issue