Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config diff logic if parent configuration is present more than once in the candidate config and update docs #189

Milestone

Comments

@ganeshrn
Copy link
Member

ganeshrn commented Dec 22, 2020

SUMMARY

If parent section present multiple times in the candidate configuration the diff is not generated correctly and
mainly applicable for <nos>_config modules

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ios_config
iosxr_config
eos_config
nxos_config
vyos_config

ANSIBLE VERSION
$ansible --version
ansible 2.9.16rc1

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- hosts: ios
  gather_facts: false
  connection: ansible.netcommon.network_cli
  tasks:
    - cisco.ios.ios_config:
        src: config.cfg
      register: result
$cat  config.cfg
interface loopback0
 ip ospf 1 area 0.0.0.0
!
interface GigabitEthernet0/1
 ip ospf 1 area 0.0.0.0
interface GigabitEthernet0/2
 ip ospf 1 area 0.0.0.0
!
router isis fabric
 is-type level-2
 net 49.0000.0000.0003.00
!
interface loopback0
 ip router isis fabric
!
interface GigabitEthernet0/1
 ip router isis fabric
interface GigabitEthernet0/2
 ip router isis fabric

Running config on the device for relevant sections

interface Loopback0
 ip address 192.168.0.1 255.255.255.0
!         
interface GigabitEthernet0/0
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
!         
interface GigabitEthernet0/1
 ip address 192.168.0.3 255.255.255.0
 shutdown 
 duplex auto
 speed auto
 media-type rj45
!         
interface GigabitEthernet0/2
 ip address 192.168.0.4 255.255.255.0
 shutdown 
 duplex auto
 speed auto
 media-type rj45
EXPECTED RESULTS

Expected commands in the output

    "commands": [
        "interface loopback0",
        "ip ospf 1 area 0.0.0.0",
        "interface GigabitEthernet0/1",
        "ip ospf 1 area 0.0.0.0",
        "interface GigabitEthernet0/2",
        "ip ospf 1 area 0.0.0.0",
        "router isis fabric",
        "is-type level-2",
        "net 49.0000.0000.0003.00",
        "interface loopback0",
        "ip router isis fabric",
        "interface GigabitEthernet0/1",
        "ip router isis fabric",
        "interface GigabitEthernet0/2",
        "ip router isis fabric"
    ],

ACTUAL RESULTS
    "commands": [
        "interface loopback0",
        "ip ospf 1 area 0.0.0.0",
        "interface GigabitEthernet0/1",
        "ip ospf 1 area 0.0.0.0",
        "interface GigabitEthernet0/2",
        "ip ospf 1 area 0.0.0.0",
        "router isis fabric",
        "is-type level-2",
        "net 49.0000.0000.0003.00",
        "interface loopback0",
        "ip router isis fabric",
        "ip router isis fabric",
        "ip router isis fabric"
    ],
ganeshrn added a commit to ganeshrn/netcommon that referenced this issue Dec 22, 2020
Fixes
ansible-collections#189

* If the parent config lines appear at multiple places in the
  configuration update list add it in the final diff along
  with child elements.
ganeshrn added a commit to ganeshrn/nxos that referenced this issue Dec 23, 2020
Fixes ansible-collections/ansible.netcommon#189

*  Update doc
*  Add warning message for idempotent pre-requisite
ganeshrn added a commit to ganeshrn/iosxr that referenced this issue Dec 23, 2020
Fixes ansible-collections/ansible.netcommon#189

*  Update doc
*  Add warning message for idempotent pre-requisite
<!--- HINT: Include "Fixes #nnn" if you are fixing an existi
ganeshrn added a commit to ganeshrn/arista.eos that referenced this issue Dec 23, 2020
ganeshrn added a commit to ganeshrn/vyos.vyos that referenced this issue Dec 23, 2020
ganeshrn added a commit to ganeshrn/vyos.vyos that referenced this issue Dec 24, 2020
ganeshrn added a commit to ganeshrn/arista.eos that referenced this issue Dec 24, 2020
ganeshrn added a commit to ganeshrn/iosxr that referenced this issue Dec 24, 2020
Fixes ansible-collections/ansible.netcommon#189

*  Update doc
*  Add warning message for idempotent pre-requisite
<!--- HINT: Include "Fixes #nnn" if you are fixing an existi
@GomathiselviS GomathiselviS added this to the January'21 milestone Jan 6, 2021
ganeshrn added a commit to ganeshrn/nxos that referenced this issue Jan 25, 2021
Fixes ansible-collections/ansible.netcommon#189

*  Update doc
*  Add warning message for idempotent pre-requisite
@ganeshrn ganeshrn reopened this Jan 26, 2021
@ganeshrn ganeshrn reopened this Jan 27, 2021
ganeshrn added a commit to ganeshrn/vyos.vyos that referenced this issue Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment