* adds commit replace with config file for iosxr (#35564)

* * adds commit replace with config file for iosxr
* fixes dci failure in iosxr_logging

* * review comment changes
This commit is contained in:
Kedar Kekan 2018-02-01 19:45:32 +05:30 committed by John R Barker
commit 684e953b50
11 changed files with 227 additions and 48 deletions

View file

@ -0,0 +1,33 @@
hostname iosxr01
line default
transport input ssh
!
interface Loopback888
description test for ansible
shutdown
!
interface MgmtEth0/0/CPU0/0
ipv4 address dhcp
!
interface preconfigure GigabitEthernet0/0/0/3
description test-interface-3
mtu 256
speed 100
duplex full
!
interface GigabitEthernet0/0/0/0
shutdown
!
interface GigabitEthernet0/0/0/1
shutdown
!
router static
address-family ipv4 unicast
0.0.0.0/0 10.0.2.2
!
!
netconf-yang agent
ssh
!
ssh server v2
ssh server netconf vrf default

View file

@ -0,0 +1,27 @@
hostname iosxr01
line default
transport input ssh
!
interface Loopback888
description test for ansible
shutdown
!
interface MgmtEth0/0/CPU0/0
ipv4 address dhcp
!
interface GigabitEthernet0/0/0/0
shutdown
!
interface GigabitEthernet0/0/0/1
shutdown
!
router static
address-family ipv4 unicast
0.0.0.0/0 10.0.2.2
!
!
netconf-yang agent
ssh
!
ssh server v2
ssh server netconf vrf default

View file

@ -0,0 +1,45 @@
---
- debug: msg="START cli/replace_config.yaml on connection={{ ansible_connection }}"
- name: setup
iosxr_config:
commands:
- no interface GigabitEthernet0/0/0/3
- name: replace config (add preconfigured interface)
iosxr_config: &addreplace
src: "{{ role_path }}/fixtures/config_add_interface.txt"
replace: config
backup: yes
register: result
- assert:
that:
- '"load harddisk:/ansible_config.txt" in result.commands'
- name: replace config (add preconfigured interface)(idempotence)
iosxr_config: *addreplace
register: result
- assert: &false
that:
- 'result.changed == false'
- name: replace config (del preconfigured interface)
iosxr_config: &delreplace
src: "{{ role_path }}/fixtures/config_del_interface.txt"
replace: config
backup: yes
register: result
- assert:
that:
- '"load harddisk:/ansible_config.txt" in result.commands'
- name: replace config (del preconfigured interface)(idempotence)
iosxr_config: *delreplace
register: result
- assert: *false
- debug: msg="END cli/replace_config.yaml on connection={{ ansible_connection }}"