Open shebang42 opened 7 months ago
I would say having both attributes set to false
is correct, I am wondering why it is trying to configure both when both are set to false. Could you please share the following information:
show run bgp ... | json unified
TF_LOG=Trace
, which should include the gNMI call issued to push the config and share this as wellThanks for your support Daniel,
Which version of the provider are you using?
Version 0.5.0 with the following patch https://github.com/CiscoDevNet/terraform-provider-iosxr/commit/8cb79b65910ea61140bca204481ba88f3edf87ad
(Add to router_bgp_vrf.yaml
):
- yang_name: use/neighbor-group
example: GROUP1
Please note that I later noticed that some local_as
stuff is missing from gen/definitions/router_bgp_neighbor_group.yaml
. I have added them later in this patch:
https://github.com/CiscoDevNet/terraform-provider-iosxr/commit/8aca4261d241f8248806eed774523391f402ac28
This patch is NOT included in the troubleshooting logs below. And although I think it's unrelated, it's worth mentioning, since it also configures local_as/*
.
Using Cisco IOS-XR Version 7.11.1 on CML.
Share the output of show run bgp ... | json unified
RP/0/RP0/CPU0:xr9kv-0#sh run router bgp 65002 vrf Azure_small | json unified
Tue Apr 9 10:18:30.094 UTC
{
"data": {
"Cisco-IOS-XR-um-router-bgp-cfg:router": {
"bgp": {
"as": [
{
"as-number": 65002,
"vrfs": {
"vrf": [
{
"vrf-name": "Azure_small",
"bfd": {
"minimum-interval": 2000,
"multiplier": 3
},
"timers": {
"bgp": {
"keepalive-interval": 10,
"holdtime": 30
}
},
"bgp": {
"router-id": "10.240.255.84"
},
"address-families": {
"address-family": [
{
"af-name": "ipv4-unicast",
"aggregate-addresses": {
"aggregate-address": [
{
"address": "10.52.0.0",
"masklength": 14,
"summary-only": {
}
},
{
"address": "10.68.0.0",
"masklength": 14,
"summary-only": {
}
},
{
"address": "10.224.0.0",
"masklength": 14,
"summary-only": {
}
},
{
"address": "10.232.0.0",
"masklength": 15,
"summary-only": {
}
},
{
"address": "10.235.0.0",
"masklength": 16,
"as-set": {
},
"summary-only": {
}
},
{
"address": "10.236.0.0",
"masklength": 16,
"as-set": {
},
"summary-only": {
}
}
]
}
}
]
},
"neighbors": {
"neighbor": [
{
"neighbor-address": "10.240.38.137",
"use": {
"neighbor-group": "Azure-to-Fastpath-BGP-group"
},
"bfd": {
"fast-detect": {
}
},
"address-families": {
"address-family": [
{
"af-name": "ipv4-unicast",
"route-policy": {
"out": "rAzure-FastPath-out(50)"
}
}
]
}
}
]
}
}
]
}
}
]
}
}
}
}
Enable debug logging by configuring an env var TF_LOG=Trace, which should include the gNMI call issued to push the config and share this as well
https://gist.github.com/shebang42/85a3fb03d1836fc487690edf8e719676
Update: I assumed that I introduced this behaviour with the yang_name: use/neighbor-group
, but I was able to reproduce this with the vanilla 0.5.0 provider.
Also noticed similar behaviour, where the TF data-source seems to 'hallucinate' configuration. Will create an issue for this shortly.
Hello,
I have added /router/bgp/as/vrfs/vrf/neighbors/neighbor/use/neighbor-group . See https://github.com/CiscoDevNet/terraform-provider-iosxr/compare/main...shebang42:terraform-provider-iosxr:feature/router-bgp-wip#diff-8b07de0d9611ac267890e0f303cb77e3cc0bb818f062500377db9d5f74623fef
This introduces an issue where
neighbors/local_as_dual_as
andneighbors/local_as_replace_as
appear to be mutually exclusive withneighbors/use_neighbor_group
in the configuration. However, I retrieve all of them in the data source. When configuring a new resource with the data from the data source, this results in an "Invalid configuration item." error.So: I want the "local_as_dual_as" and "local_as_replace_as" from the data source to return "null" and not some boolean value when "use_neighbor_group" has a value. Is this possible, or is this a restriction of the YANG model?
Details:
Workflow:
Retrieve config
1) Retrieve router config with the
iosxr_router_bgp_vrf
data source 2) Convert to YAML and write to fileConfigure device
3) Read configuration file and decode YAML 4) configure device with
iosxr_router_bgp_vrf
resource.This results in a "BGP' detected the 'warning' condition 'Invalid configuration item." error.
Cisco configuration
Note that this configuration contains a
use neighbor-group
.RP/0/RP0/CPU0:xr9kv-0#sh run router bgp 65002 vrf Azure_small router bgp 65002 vrf Azure_small address-family ipv4 unicast <..> ! neighbor 10.
use neighbor-group Azure-group
bfd fast-detect
address-family ipv4 unicast
route-policy rAzure-out(50) out
!
Retrieve data
Output of
terraform apply
Note that this output contains
use_neighbor_group
, as well aslocal_as_dual_as
andlocal_as_replace_as
Configure device:
However, when
local_as_dual_as
andlocal_as_replace_as
are removed from the yaml file, the configuration is oke:So, to summarize: I want the "local_as_dual_as" and "local_as_replace_as" from the data source to return "null" and not some boolean value when "use_neighbor_group" has a value.
Do you have any suggestions how to fix this? Do I overlook something?
I would be able to fix this in the TF code with a local variable. Something like below, but this would be a workaround for a limitation in the provider, so this is not the preferred solution.