add missing files (#22496)

This commit is contained in:
John R Barker 2017-03-10 15:29:36 +00:00 committed by GitHub
parent 5dac2ee00c
commit 89e4226051
4 changed files with 187 additions and 0 deletions

View file

@ -0,0 +1,33 @@
---
- name: collect all eapi test cases
find:
paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #"
- name: enable eapi
eos_eapi:
enable_http: yes
enable_https: yes
enable_local_http: yes
enable_socket: yes
provider: "{{ cli }}"
# authorize: yes
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
enable_http: no
enable_https: no
enable_local_http: no
enable_socket: no
provider: "{{ cli }}"
# authorize: yes

View file

@ -0,0 +1,55 @@
---
- name: setup - remove login
eos_banner:
banner: login
state: absent
authorize: yes
transport: "{{ eapi }}"
- name: Set login
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: present
authorize: yes
transport: "{{ eapi }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'this is my login banner' in result.commands"
- "'that has a multiline' in result.commands"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Set login again (idempotent)
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: present
authorize: yes
transport: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"

View file

@ -0,0 +1,53 @@
---
- name: setup - remove motd
eos_banner:
banner: motd
state: absent
authorize: yes
- name: Set motd
eos_banner:
banner: motd
text: |
this is my motd banner
that has a multiline
string
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'this is my motd banner' in result.commands"
- "'that has a multiline' in result.commands"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Set motd again (idempotent)
eos_banner:
banner: motd
text: |
this is my motd banner
that has a multiline
string
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name contains 'ansible_1'"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"

View file

@ -0,0 +1,46 @@
---
- name: Setup
eos_banner:
banner: login
text: Junk login banner single line
state: present
authorize: yes
provider: "{{ eapi }}"
- name: remove login
eos_banner:
banner: login
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- debug:
msg: "{{ result }}"
- assert:
that:
- "result.changed == true"
- "'no banner login' in result.commands" # does this break due to "contains?"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: remove login (idempotent)
eos_banner:
banner: login
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"