napalm
napalm copied to clipboard
when replace_config: true, the diff files can't show the command add/delete in Ansible check mode
Description of Issue/Question
We are try to use Ansible/Napalm to manage our Cisco NCS routers(IOSXR). We did a change for bgp to update the route-policy with Ansible/Napalm
router bgp 65001
neighbor-group LB_Clusters
address-family ipv4 unicast
- route-policy LB_Clusters_IN in
+ route-policy DENY-ALL in
route-policy LB_Clusters_OUT out
We checked the diff files in Ansible check mode ( replace_config to true in palybook)
pji@las4779:~/repos/network_ansible$ cat configs/sha1-extrtr-a/diff
# router bgp 65001
# neighbor-group LB_Clusters
# address-family ipv4 unicast
# route-policy LB_Clusters_IN in
# route-policy DENY-ALL in
# !
The diff configure is not as expect because it didn't show up which command is add or delete.
and then we tired to change replace_config to false
diff --git a/playbooks/ncs_routers.yml b/playbooks/ncs_routers.yml
index 28f46b9..e450b85 100644
--- a/playbooks/ncs_routers.yml
+++ b/playbooks/ncs_routers.yml
@@ -99,7 +99,7 @@
config_file: "{{ host_config_dir }}/assembled.conf"
commit_changes: "{{ not ansible_check_mode }}"
diff_file: "{{ host_config_dir }}/diff"
- replace_config: true
+ replace_config: False
timeout: "{{ napalm_config_timeout|default('150') }}"
optional_args:
ssl_verify: False
and then check the diff file in Ansible check mode find the diff files can show us the add or delete line
pji@las4779:~/repos/network_ansible$ cat configs/sha1-extrtr-a/diff
---
+++
@@ -453,7 +453,7 @@
!
neighbor-group LB_Clusters
address-family ipv4 unicast
- route-policy LB_Clusters_IN in
+ route-policy DENY-ALL in
route-policy LB_Clusters_OUT out
!
Not sure why the replace_config: true/false
case the diff file format different in IOSXR?
We have Cisco NXOS devices using replace_config: true
which can show us the commands added or deleted.
Is replace_config: false
best practice in Napalm in IOSXR ?
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an x
between the square brackets where applicable)
- [] Yes
- [] No
Setup
napalm version
(Paste verbatim output from pip freeze | grep napalm
between quotes below)
pji@las4779:~/repos/network_ansible$ pip freeze | grep napalm
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
napalm==2.3.1
napalm-ansible==0.9.1
Network operating system version
(Paste verbatim output from show version
- or equivalent - between quotes below)
RP/0/RP0/CPU0:las1-xrv-1#sho version
Tue Feb 23 04:09:40.200 UTC
Cisco IOS XR Software, Version 7.1.1
Copyright (c) 2013-2020 by Cisco Systems, Inc.
Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)
NAPALM 2.3.1 is obsolete. You would need to reproduce the issue in the latest released version of NAPALM (NAPALM 3.2.0)