Fix eapi tests to use become (#40838)

* Return the expected prompt character based on become status

* Update eos_banner tests for eapi

* Update eos_config tests for eapi

* Update eos_facts tests for eapi

* Update eos_interface tests for eapi

* Update eos_l3_interface tests for eapi

* Update eos_lldp tests for eapi

* Update eos_logging tests for eapi

* Update eos_smoke tests for eapi

* Update eos_system tests for eapi
This commit is contained in:
Nathaniel Case
2018-05-29 14:18:03 -04:00
committed by GitHub
parent 669949e6a3
commit 20f93816d6
59 changed files with 217 additions and 490 deletions

View File

@@ -9,11 +9,13 @@
parents:
- interface Ethernet2
match: none
become: yes
- name: configure device with defaults included
eos_config:
src: defaults/config.j2
defaults: yes
become: yes
register: result
- debug: var=result
@@ -27,6 +29,7 @@
eos_config:
src: defaults/config.j2
defaults: yes
become: yes
register: result
- debug: var=result

View File

@@ -9,24 +9,24 @@
parents:
- interface Ethernet2
match: none
become: yes
- name: save config
eos_config:
- name: save config always
eos_config: &always
save_when: always
become: yes
register: result
- assert:
- assert: &changed
that:
- "result.changed == true"
- name: save should always run
eos_config:
save_when: always
eos_config: *always
become: yes
register: result
- assert:
that:
- "result.changed == true"
- assert: *changed
- debug: msg="END eapi/save.yaml"

View File

@@ -9,10 +9,12 @@
parents:
- interface Ethernet2
match: none
become: yes
- name: configure device with config
eos_config:
src: basic/config.j2
become: yes
register: result
- assert:
@@ -24,6 +26,7 @@
- name: check device with config
eos_config:
src: basic/config.j2
become: yes
register: result
- assert:

View File

@@ -9,11 +9,13 @@
parents:
- interface Ethernet2
match: none
become: yes
- name: configure device with config
eos_config:
src: basic/config.j2
match: none
become: yes
register: result
- assert:
@@ -25,6 +27,7 @@
- name: check device with config
eos_config:
src: basic/config.j2
become: yes
register: result
- assert:

View File

@@ -5,12 +5,14 @@
eos_config:
lines: no ip access-list test
match: none
become: yes
- name: configure sub level command
eos_config:
lines: 10 permit ip any any log
parents: ip access-list test
after: exit
become: yes
register: result
- assert:
@@ -23,6 +25,7 @@
eos_config:
lines: 10 permit ip any any log
parents: ip access-list test
become: yes
register: result
- assert:
@@ -33,5 +36,6 @@
eos_config:
lines: no ip access-list test
match: none
become: yes
- debug: msg="END eapi/sublevel.yaml"

View File

@@ -10,6 +10,7 @@
parents: ip access-list test
before: no ip access-list test
match: none
become: yes
- name: configure sub level command using block resplace
eos_config:
@@ -21,6 +22,7 @@
parents: ip access-list test
after: end
replace: block
become: yes
register: result
- assert:
@@ -41,6 +43,7 @@
- 40 permit ip host 4.4.4.4 any log
parents: ip access-list test
replace: block
become: yes
register: result
- assert:
@@ -51,5 +54,6 @@
eos_config:
lines: no ip access-list test
match: none
become: yes
- debug: msg="END eapi/sublevel_block.yaml"

View File

@@ -13,6 +13,7 @@
before: no ip access-list test
after: exit
match: none
become: yes
- name: configure sub level command using exact match
eos_config:
@@ -21,10 +22,11 @@
- 20 permit ip host 2.2.2.2 any log
- 30 permit ip host 3.3.3.3 any log
- 40 permit ip host 4.4.4.4 any log
before: no ip access-list test
parents: ip access-list test
before: no ip access-list test
after: exit
match: exact
become: yes
register: result
- assert:
@@ -47,6 +49,7 @@
before: no ip access-list test
parents: ip access-list test
match: exact
become: yes
register: result
- assert:
@@ -57,5 +60,6 @@
eos_config:
lines: no ip access-list test
match: none
become: yes
- debug: msg="END eapi/sublevel_exact.yaml"

View File

@@ -12,6 +12,7 @@
parents: ip access-list test
before: no ip access-list test
match: none
become: yes
- name: configure sub level command using strict match
eos_config:
@@ -25,6 +26,7 @@
after: exit
match: strict
replace: block
become: yes
register: result
- assert:
@@ -46,6 +48,7 @@
- 40 permit ip host 4.4.4.4 any log
parents: ip access-list test
match: strict
become: yes
register: result
- assert:
@@ -56,5 +59,6 @@
eos_config:
lines: no ip access-list test
match: none
become: yes
- debug: msg="END eapi/sublevel_strict.yaml"

View File

@@ -5,10 +5,12 @@
eos_config:
lines: hostname {{ inventory_hostname_short }}
match: none
become: yes
- name: configure top level command
eos_config:
lines: hostname foo
become: yes
register: result
- assert:
@@ -19,6 +21,7 @@
- name: configure top level command idempotent check
eos_config:
lines: hostname foo
become: yes
register: result
- assert:
@@ -29,5 +32,6 @@
eos_config:
lines: hostname {{ inventory_hostname_short }}
match: none
become: yes
- debug: msg="END eapi/toplevel.yaml"

View File

@@ -4,14 +4,16 @@
- name: setup
eos_config:
lines:
- "snmp-server contact ansible"
- snmp-server contact ansible
- "hostname {{ inventory_hostname_short }}"
match: none
become: yes
- name: configure top level command with before
eos_config:
lines: hostname foo
after: snmp-server contact bar
become: yes
register: result
- assert:
@@ -24,6 +26,7 @@
eos_config:
lines: hostname foo
after: snmp-server contact foo
become: yes
register: result
- assert:
@@ -36,5 +39,6 @@
- no snmp-server contact
- hostname {{ inventory_hostname_short }}
match: none
become: yes
- debug: msg="END eapi/toplevel_after.yaml"

View File

@@ -7,11 +7,13 @@
- "snmp-server contact ansible"
- "hostname {{ inventory_hostname_short }}"
match: none
become: yes
- name: configure top level command with before
eos_config:
lines: hostname foo
before: snmp-server contact bar
become: yes
register: result
- assert:
@@ -24,6 +26,7 @@
eos_config:
lines: hostname foo
before: snmp-server contact foo
become: yes
register: result
- assert:
@@ -33,8 +36,9 @@
- name: teardown
eos_config:
lines:
- no snmp-server contact ansible
- hostname {{ inventory_hostname_short }}
- no snmp-server contact
- "hostname {{ inventory_hostname_short }}"
match: none
become: yes
- debug: msg="END eapi/toplevel_before.yaml"