Open eldina07 opened 1 year ago
I believe this issues actually lies directly into ansible.netcommon
. See the following snippet:
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import (
NetworkConfig,
dumps,
)
candidate_str = """
neighbor 10.0.0.0/24
use neighbor-group peer-leaf-overlay
description first-prefix
neighbor 10.0.1.0/24
use neighbor-group peer-leaf-overlay
description second-prefix
neighbor 10.0.2.0/24
use neighbor-group peer-leaf-overlay
description third-prefix
"""
candidate_obj = NetworkConfig(indent=2, comment_tokens=["!"])
candidate_obj.add(candidate_str.strip().splitlines())
print(dumps(candidate_obj, "raw"))
And its corresponding output:
neighbor 10.0.0.0/24
use neighbor-group peer-leaf-overlay
description first-prefix
neighbor 10.0.1.0/24
description second-prefix
neighbor 10.0.2.0/24
description third-prefix
All use neighbor-group peer-leaf-overlay
lines except the first have indeed vanished from the configuration. This seems to boil down to this specific line in NetworkConfig
. The add
method simply disregards "duplicate" lines, no matter where they appear (within the same block or any other block, so long as the indent is the same)
SUMMARY
Hello,
We have an issue when we try to apply a remediation configuration to a cisco XR with command
use neighbor-group TEMPLATE
. We have multiple prefixes which use a neighbor-group but only the first prefix is apply. The output commands from iosxr_config removeuse neighbor-group TEMPLATE
but we don't know why.Example for remediation_config:
Output commands:
So
use neighbor-group
is removed when it's not the first neighbor. We try with few verions, it's the same (3.3.1 and 5.0.1). This works well if we apply all configuration in one time (but we want to change few line by few lines so it's important for us)ISSUE TYPE
COMPONENT NAME
cisco.iosxr.iosxr_config
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
debian/11
STEPS TO REPRODUCE
Example for remediation_config:
EXPECTED RESULTS
Output commands:
ACTUAL RESULTS
Output commands:
If you want more informations, don't hesitate.