Remove Deprecated Template network modules (#27076)

* removed deprecated networking template modules

* update changelog

* update changelog
This commit is contained in:
David Newswanger 2017-07-27 14:40:11 -04:00 committed by John R Barker
parent 0fb64214a4
commit 81151ef02c
86 changed files with 8 additions and 3420 deletions

View file

@ -40,15 +40,6 @@
failed_modules: "{{ failed_modules }} + [ 'eos_config' ]"
test_failed: true
- block:
- include_role:
name: eos_template
when: "limit_to in ['*', 'eos_template']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'eos_template' ]"
test_failed: true
- block:
- include_role:
name: eos_facts

View file

@ -49,15 +49,6 @@
failed_modules: "{{ failed_modules }} + [ 'ios_facts' ]"
test_failed: true
- block:
- include_role:
name: ios_template
when: "limit_to in ['*', 'ios_template']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'ios_template' ]"
test_failed: true
- block:
- include_role:
name: ios_system

View file

@ -42,15 +42,6 @@
failed_modules: "{{ failed_modules }} + [ 'iosxr_facts' ]"
test_failed: true
- block:
- include_role:
name: iosxr_template
when: "limit_to in ['*', 'iosxr_template']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'iosxr_template' ]"
test_failed: true
- block:
- include_role:
name: iosxr_system

View file

@ -61,14 +61,6 @@
failed_modules: "{{ failed_modules }} + [ 'junos_rpc' ]"
test_failed: true
- block:
- include_role:
name: junos_template
when: "limit_to in ['*', 'junos_template']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'junos_template' ]"
test_failed: true
- block:
- include_role:
name: junos_vlan

View file

@ -42,15 +42,6 @@
failed_modules: "{{ failed_modules }} + [ 'nxos_facts' ]"
test_failed: true
- block:
- include_role:
name: nxos_template
when: "limit_to in ['*', 'nxos_template']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'nxos_template' ]"
test_failed: true
- block:
- include_role:
name: nxos_nxapi

View file

@ -1,2 +0,0 @@
---
testcase: "*"

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_eos_tests

View file

@ -1,15 +0,0 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,28 +0,0 @@
---
- 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:
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- 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:
state: stopped
provider: "{{ cli }}"

View file

@ -1,3 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: eapi.yaml, tags: ['eapi'] }

View file

@ -1,4 +0,0 @@
interface Ethernet2
description this is a test
shutdown

View file

@ -1,4 +0,0 @@
interface Ethernet2
description test description from ansible
shutdown

View file

@ -1,3 +0,0 @@
interface Ethernet2
description this is a test
no shutdown

View file

@ -1,4 +0,0 @@
interface Ethernet2
description this is a test
shutdown

View file

@ -1,50 +0,0 @@
---
- debug: msg="START cli/backup.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ cli }}"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
eos_template:
src: basic/config.j2
backup: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- debug: msg="END cli/backup.yaml"

View file

@ -1,36 +0,0 @@
---
- debug: msg="START cli/basic.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ cli }}"
- name: configure device with config
eos_template:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
eos_template:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END cli/basic.yaml"

View file

@ -1,42 +0,0 @@
---
- debug: msg="START cli/defaults.yaml"
- name: setup
eos_config:
commands:
- no description
- shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ cli }}"
- name: configure device with defaults included
eos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ cli }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with defaults included
eos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ cli }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END cli/defaults.yaml"

View file

@ -1,38 +0,0 @@
---
- debug: msg="START cli/force.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ cli }}"
- name: configure device with config
eos_template:
src: basic/config.j2
provider: "{{ cli }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
eos_template:
src: basic/config.j2
provider: "{{ cli }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- debug: msg="END cli/force.yaml"

View file

@ -1,50 +0,0 @@
---
- debug: msg="START eapi/backup.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ eapi }}"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
eos_template:
src: basic/config.j2
backup: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- debug: msg="END eapi/backup.yaml"

View file

@ -1,36 +0,0 @@
---
- debug: msg="START eapi/basic.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ eapi }}"
- name: configure device with config
eos_template:
src: basic/config.j2
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
eos_template:
src: basic/config.j2
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END eapi/basic.yaml"

View file

@ -1,42 +0,0 @@
---
- debug: msg="START eapi/defaults.yaml"
- name: setup
eos_config:
commands:
- no description
- shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ eapi }}"
- name: configure device with defaults included
eos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ eapi }}"
register: result
#- debug: var=result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with defaults included
eos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ eapi }}"
register: result
#- debug: var=result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END eapi/defaults.yaml"

View file

@ -1,38 +0,0 @@
---
- debug: msg="START eapi/force.yaml"
- name: setup
eos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2
match: none
provider: "{{ eapi }}"
- name: configure device with config
eos_template:
src: basic/config.j2
provider: "{{ eapi }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
eos_template:
src: basic/config.j2
provider: "{{ eapi }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- debug: msg="END eapi/force.yaml"

View file

@ -1,3 +0,0 @@
---
testcase: "*"
test_items: []

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_ios_tests

View file

@ -1,16 +0,0 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
delegate_to: localhost
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,2 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }

View file

@ -1,4 +0,0 @@
interface Loopback999
description this is a test
shutdown

View file

@ -1,4 +0,0 @@
interface Loopback999
description this is a test
no shutdown

View file

@ -1,52 +0,0 @@
---
- debug: msg="START cli/backup.yaml"
- name: setup
ios_config:
commands:
- no interface Loopback999
match: none
ignore_errors: yes
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
ios_template:
src: basic/config.j2
backup: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- name: teardown
ios_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/backup.yaml"

View file

@ -1,37 +0,0 @@
---
- debug: msg="START cli/basic.yaml"
- name: setup
ios_config:
commands:
- no interface Loopback999
match: none
ignore_errors: yes
- name: configure device with config
ios_template:
src: basic/config.j2
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
ios_template:
src: basic/config.j2
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- name: teardown
ios_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/basic.yaml"

View file

@ -1,37 +0,0 @@
---
- debug: msg="START cli/defaults.yaml"
- name: setup
ios_config:
commands: no interface Loopback999
match: none
ignore_errors: yes
- name: configure device with defaults included
ios_template:
src: defaults/config.j2
include_defaults: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with defaults included
ios_template:
src: defaults/config.j2
include_defaults: yes
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- name: teardown
ios_config:
commands: no interface Loopback999
match: none
- debug: msg="END cli/defaults.yaml"

View file

@ -1,39 +0,0 @@
---
- debug: msg="START cli/force.yaml"
- name: setup
ios_config:
commands:
- no interface Loopback999
match: none
ignore_errors: yes
- name: configure device with config
ios_template:
src: basic/config.j2
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
ios_template:
src: basic/config.j2
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: teardown
ios_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/force.yaml"

View file

@ -1,3 +0,0 @@
---
testcase: "*"
test_items: []

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_iosxr_tests

View file

@ -1,16 +0,0 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
delegate_to: localhost
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,2 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }

View file

@ -1,5 +0,0 @@
hostname {{ inventory_hostname_short }}
!
interface Loopback999
description this is a test
shutdown

View file

@ -1,52 +0,0 @@
---
- debug: msg="START cli/backup.yaml"
- name: setup
iosxr_config:
commands:
- no interface Loopback999
match: none
ignore_errors: yes
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
iosxr_template:
src: basic/config.j2
backup: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- name: teardown
iosxr_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/backup.yaml"

View file

@ -1,36 +0,0 @@
---
- debug: msg="START cli/basic.yaml"
- name: setup
iosxr_config:
commands:
- no interface Loopback999
match: none
- name: configure device with config
iosxr_template:
src: basic/config.j2
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
iosxr_template:
src: basic/config.j2
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- name: teardown
iosxr_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/basic.yaml"

View file

@ -1,38 +0,0 @@
---
- debug: msg="START cli/force.yaml"
- name: setup
iosxr_config:
commands:
- no interface Loopback999
match: none
- name: configure device with config
iosxr_template:
src: basic/config.j2
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
iosxr_template:
src: basic/config.j2
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: teardown
iosxr_config:
commands:
- no interface Loopback999
match: none
- debug: msg="END cli/force.yaml"

View file

@ -1,3 +0,0 @@
---
testcase: "*"
test_cases: []

View file

@ -1,2 +0,0 @@
---
- { include: netconf.yaml, tags: ['netconf'] }

View file

@ -1,15 +0,0 @@
---
- name: collect netconf test cases
find:
paths: "{{ role_path }}/tests/netconf"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,10 +0,0 @@
interfaces {
lo0 {
unit 0 {
family inet {
address 1.1.1.1/32;
}
}
}
}

View file

@ -1,54 +0,0 @@
---
- debug: msg="START netconf/backup.yaml"
- name: setup
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
provider: "{{ netconf }}"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure using template with backup
junos_template:
src: basic/config.j2
backup: yes
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'1.1.1.1/32' in result.diff.prepared"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- name: teardown
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
provider: "{{ netconf }}"
- debug: msg="END netconf/backup.yaml"

View file

@ -1,39 +0,0 @@
---
- debug: msg="START netconf/basic.yaml"
- name: setup
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
provider: "{{ netconf }}"
- name: configure basic config template
junos_template:
src: basic/config.j2
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'1.1.1.1/32' in result.diff.prepared"
- name: check basic config template idempotent
junos_template:
src: basic/config.j2
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: teardown
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
provider: "{{ netconf }}"
- debug: msg="END netconf/basic.yaml"

View file

@ -1,43 +0,0 @@
---
- debug: msg="START netconf/force.yaml"
- name: setup
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
provider: "{{ netconf }}"
- name: configure basic config template
junos_template:
src: basic/config.j2
provider: "{{ netconf }}"
action: replace
register: result
- assert:
that:
- "result.changed == true"
- "'1.1.1.1/32' in result.diff.prepared"
- name: check basic config template idempotent
junos_template:
src: basic/config-update.j2
action: replace
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'1.1.1.1/32' in result.diff.prepared"
- name: teardown
junos_config:
lines:
- set system host-name {{ inventory_hostname_short }}
- delete interfaces lo0
action: replace
provider: "{{ netconf }}"
- debug: msg="END netconf/force.yaml"

View file

@ -1,3 +0,0 @@
---
testcase: "*"
test_items: []

View file

@ -1,2 +0,0 @@
dependencies:
- prepare_nxos_tests

View file

@ -1,15 +0,0 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,3 +0,0 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -1,28 +0,0 @@
---
- name: collect all nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable nxapi
nxos_config:
lines:
- feature nxapi
- nxapi http port 80
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
- name: disable nxapi
nxos_config:
lines:
- no feature nxapi
provider: "{{ cli }}"

View file

@ -1,4 +0,0 @@
interface Ethernet2/5
description this is a test
shutdown

View file

@ -1,4 +0,0 @@
interface Ethernet2/5
description test description from ansible
shutdown

View file

@ -1,4 +0,0 @@
interface Ethernet2/5
description this is a test
no shutdown

View file

@ -1,4 +0,0 @@
interface Ethernet2/5
description this is a test
shutdown

View file

@ -1,50 +0,0 @@
---
- debug: msg="START cli/backup.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ cli }}"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
nxos_template:
src: basic/config.j2
backup: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- debug: msg="END cli/backup.yaml"

View file

@ -1,36 +0,0 @@
---
- debug: msg="START cli/basic.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ cli }}"
- name: configure device with config
nxos_template:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
nxos_template:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END cli/basic.yaml"

View file

@ -1,42 +0,0 @@
---
- debug: msg="START cli/defaults.yaml"
- name: setup
nxos_config:
commands:
- no description
- shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ cli }}"
- name: configure device with defaults included
nxos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ cli }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with defaults included
nxos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ cli }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END cli/defaults.yaml"

View file

@ -1,38 +0,0 @@
---
- debug: msg="START cli/force.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ cli }}"
- name: configure device with config
nxos_template:
src: basic/config.j2
provider: "{{ cli }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
nxos_template:
src: basic/config.j2
provider: "{{ cli }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- debug: msg="END cli/force.yaml"

View file

@ -1,50 +0,0 @@
---
- debug: msg="START nxapi/backup.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ nxapi }}"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
nxos_template:
src: basic/config.j2
backup: yes
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- debug: msg="END nxapi/backup.yaml"

View file

@ -1,36 +0,0 @@
---
- debug: msg="START nxapi/basic.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ nxapi }}"
- name: configure device with config
nxos_template:
src: basic/config.j2
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
nxos_template:
src: basic/config.j2
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END nxapi/basic.yaml"

View file

@ -1,42 +0,0 @@
---
- debug: msg="START nxapi/defaults.yaml"
- name: setup
nxos_config:
commands:
- no description
- shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ nxapi }}"
- name: configure device with defaults included
nxos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ nxapi }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with defaults included
nxos_template:
src: defaults/config.j2
include_defaults: yes
provider: "{{ nxapi }}"
register: result
- debug: var=result
- assert:
that:
- "result.changed == false"
- "result.updates is defined"
- debug: msg="END nxapi/defaults.yaml"

View file

@ -1,38 +0,0 @@
---
- debug: msg="START nxapi/force.yaml"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- interface Ethernet2/5
match: none
provider: "{{ nxapi }}"
- name: configure device with config
nxos_template:
src: basic/config.j2
provider: "{{ nxapi }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: check device with config
nxos_template:
src: basic/config.j2
provider: "{{ nxapi }}"
force: yes
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- debug: msg="END nxapi/force.yaml"

View file

@ -298,7 +298,6 @@ lib/ansible/modules/network/cumulus/_cl_ports.py
lib/ansible/modules/network/cumulus/nclu.py
lib/ansible/modules/net_tools/dnsimple.py
lib/ansible/modules/net_tools/dnsmadeeasy.py
lib/ansible/modules/network/eos/_eos_template.py
lib/ansible/modules/network/eos/eos_banner.py
lib/ansible/modules/network/eos/eos_command.py
lib/ansible/modules/network/eos/eos_config.py
@ -312,13 +311,11 @@ lib/ansible/modules/network/fortios/fortios_config.py
lib/ansible/modules/network/fortios/fortios_ipv4_policy.py
lib/ansible/modules/network/illumos/dladm_iptun.py
lib/ansible/modules/network/illumos/dladm_linkprop.py
lib/ansible/modules/network/ios/_ios_template.py
lib/ansible/modules/network/ios/ios_banner.py
lib/ansible/modules/network/ios/ios_command.py
lib/ansible/modules/network/ios/ios_facts.py
lib/ansible/modules/network/ios/ios_system.py
lib/ansible/modules/network/ios/ios_vrf.py
lib/ansible/modules/network/iosxr/_iosxr_template.py
lib/ansible/modules/network/iosxr/iosxr_command.py
lib/ansible/modules/network/iosxr/iosxr_config.py
lib/ansible/modules/network/iosxr/iosxr_facts.py
@ -337,7 +334,6 @@ lib/ansible/modules/network/netvisor/pn_vrouterif.py
lib/ansible/modules/network/netvisor/pn_vrouterlbif.py
lib/ansible/modules/net_tools/nmcli.py
lib/ansible/modules/network/nxos/_nxos_mtu.py
lib/ansible/modules/network/nxos/_nxos_template.py
lib/ansible/modules/network/nxos/nxos_aaa_server.py
lib/ansible/modules/network/nxos/nxos_aaa_server_host.py
lib/ansible/modules/network/nxos/nxos_command.py
@ -374,7 +370,6 @@ lib/ansible/modules/network/nxos/nxos_vtp_domain.py
lib/ansible/modules/network/nxos/nxos_vtp_password.py
lib/ansible/modules/network/nxos/nxos_vtp_version.py
lib/ansible/modules/net_tools/omapi_host.py
lib/ansible/modules/network/openswitch/_ops_template.py
lib/ansible/modules/network/openswitch/ops_command.py
lib/ansible/modules/network/openswitch/ops_config.py
lib/ansible/modules/network/openswitch/ops_facts.py

View file

@ -1,12 +0,0 @@
!
hostname router
!
interface GigabitEthernet0/0
ip address 1.2.3.4 255.255.255.0
description test string
!
interface GigabitEthernet0/1
ip address 6.7.8.9 255.255.255.0
description test string
shutdown
!

View file

@ -1,13 +0,0 @@
!
hostname router
!
interface GigabitEthernet0/0
ip address 1.2.3.4 255.255.255.0
description test string
no shutdown
!
interface GigabitEthernet0/1
ip address 6.7.8.9 255.255.255.0
description test string
shutdown
!

View file

@ -1,11 +0,0 @@
!
hostname foo
!
interface GigabitEthernet0/0
no ip address
!
interface GigabitEthernet0/1
ip address 6.7.8.9 255.255.255.0
description test string
shutdown
!

View file

@ -1,87 +0,0 @@
#
# (c) 2016 Red Hat Inc.
#
# 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 coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from ansible.modules.network.ios import _ios_template
from .ios_module import TestIosModule, load_fixture, set_module_args
class TestIosTemplateModule(TestIosModule):
module = _ios_template
def setUp(self):
self.mock_get_config = patch('ansible.modules.network.ios._ios_template.get_config')
self.get_config = self.mock_get_config.start()
self.mock_load_config = patch('ansible.modules.network.ios._ios_template.load_config')
self.load_config = self.mock_load_config.start()
def tearDown(self):
self.mock_get_config.stop()
self.mock_load_config.stop()
def load_fixtures(self, commands=None):
config_file = 'ios_template_config.cfg'
self.get_config.return_value = load_fixture(config_file)
self.load_config.return_value = None
def test_ios_template_unchanged(self):
src = load_fixture('ios_template_config.cfg')
set_module_args(dict(src=src))
self.execute_module()
def test_ios_template_simple(self):
src = load_fixture('ios_template_src.cfg')
set_module_args(dict(src=src))
commands = ['hostname foo',
'interface GigabitEthernet0/0',
'no ip address']
self.execute_module(changed=True, commands=commands)
def test_ios_template_force(self):
src = load_fixture('ios_template_config.cfg')
set_module_args(dict(src=src, force=True))
commands = [str(s).strip() for s in src.split('\n') if s and s != '!']
self.execute_module(changed=True, commands=commands)
self.assertFalse(self.get_config.called)
def test_ios_template_backup(self):
set_module_args(dict(backup=True))
result = self.execute_module()
self.assertIn('__backup__', result)
def test_ios_template_config(self):
src = load_fixture('ios_template_config.cfg')
config = 'hostname router'
set_module_args(dict(src=src, config=config))
commands = ['interface GigabitEthernet0/0',
'ip address 1.2.3.4 255.255.255.0',
'description test string',
'interface GigabitEthernet0/1',
'ip address 6.7.8.9 255.255.255.0',
'description test string',
'shutdown']
self.execute_module(changed=True, commands=commands)
self.assertFalse(self.get_config.called)

View file

@ -1,12 +0,0 @@
!
hostname router
!
interface GigabitEthernet0/0
ip address 1.2.3.4 255.255.255.0
description test string
!
interface GigabitEthernet0/1
ip address 6.7.8.9 255.255.255.0
description test string
shutdown
!

View file

@ -1,11 +0,0 @@
!
hostname foo
!
interface GigabitEthernet0/0
no ip address
!
interface GigabitEthernet0/1
ip address 6.7.8.9 255.255.255.0
description test string
shutdown
!

View file

@ -1,87 +0,0 @@
#
# (c) 2016 Red Hat Inc.
#
# 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 coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from .iosxr_module import TestIosxrModule, load_fixture, set_module_args
from ansible.modules.network.iosxr import _iosxr_template
class TestIosxrTemplateModule(TestIosxrModule):
module = _iosxr_template
def setUp(self):
self.mock_get_config = patch('ansible.modules.network.iosxr._iosxr_template.get_config')
self.get_config = self.mock_get_config.start()
self.mock_load_config = patch('ansible.modules.network.iosxr._iosxr_template.load_config')
self.load_config = self.mock_load_config.start()
def tearDown(self):
self.mock_get_config.stop()
self.mock_load_config.stop()
def load_fixtures(self, commands=None):
config_file = 'iosxr_template_config.cfg'
self.get_config.return_value = load_fixture(config_file)
self.load_config.return_value = None
def test_iosxr_template_unchanged(self):
src = load_fixture('iosxr_template_config.cfg')
set_module_args(dict(src=src))
self.execute_module()
def test_iosxr_template_simple(self):
src = load_fixture('iosxr_template_src.cfg')
set_module_args(dict(src=src))
commands = ['hostname foo',
'interface GigabitEthernet0/0',
'no ip address']
self.execute_module(changed=True, commands=commands)
def test_iosxr_template_force(self):
src = load_fixture('iosxr_template_config.cfg')
set_module_args(dict(src=src, force=True))
commands = [str(s).strip() for s in src.split('\n') if s and s != '!']
self.execute_module(changed=True, commands=commands)
self.assertFalse(self.get_config.called)
def test_iosxr_template_backup(self):
set_module_args(dict(backup=True))
result = self.execute_module()
self.assertIn('__backup__', result)
def test_iosxr_template_config(self):
src = load_fixture('iosxr_template_config.cfg')
config = 'hostname router'
set_module_args(dict(src=src, config=config))
commands = ['interface GigabitEthernet0/0',
'ip address 1.2.3.4 255.255.255.0',
'description test string',
'interface GigabitEthernet0/1',
'ip address 6.7.8.9 255.255.255.0',
'description test string',
'shutdown']
self.execute_module(changed=False)
self.assertTrue(self.get_config.called)