Skip to content

Prevent gNMI set operation error "bad-element": "keepalive-interval" … #286

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomvrugt
Copy link

@tomvrugt tomvrugt commented May 8, 2025

…when removing BGP timers from router_bgp_vrf_neighbor

…when removing BGP timers from router_bgp_vrf_neighbor
@danischm
Copy link
Member

danischm commented May 9, 2025

Is this something that has changed with a specific version? Looking at our CI pipelines, the existing code seems to work with 7.6.1 and 24.2.2.

@tomvrugt
Copy link
Author

tomvrugt commented May 9, 2025

Is this something that has changed with a specific version? Looking at our CI pipelines, the existing code seems to work with 7.6.1 and 24.2.2.

I don't think it's version specific. Without the delete_parent option timers/holdtime and timers/keepalive_interval are being removed seperately resulting in error as one cannot exist without the other, so it should actually remove the parent timers/ container. It's in line with the same parameters placed directly under router bgp vrf (not under neighbor) in the existing code:
https://github.com/CiscoDevNet/terraform-provider-iosxr/blob/main/gen/definitions/router_bgp_vrf.yaml#L44-L51

@tomvrugt
Copy link
Author

tomvrugt commented May 9, 2025

To reproduce the issue against 24.2.2:

main.tf

terraform {
  required_providers {
    iosxr = {
      source  = "CiscoDevNet/iosxr"
      version = ">= 0.5.3"
    }
  }
}

provider "iosxr" {
  username = "***"
  password = "***"
  host     = "1.2.3.4:57777"
}

resource "iosxr_vrf" "vrf_TST_VRF_TOM" {
  vrf_name                    = "TST_VRF_TOM"
  address_family_ipv4_unicast = true
  rd_two_byte_as_as_number    = "65123"
  rd_two_byte_as_index        = 1
}

resource "iosxr_router_bgp_vrf" "router_bgp_vrf_TST_VRF_TOM" {
  as_number     = 65003
  vrf_name      = iosxr_vrf.vrf_TST_VRF_TOM.vrf_name
  bgp_router_id = "99.99.99.99"
  neighbors = [
    {
      neighbor_address          = "1.2.3.4"
      remote_as                 = "65123"
#      timers_keepalive_interval = "5"
#      timers_holdtime           = "20"
    }
  ]
}

commenting out timers_keepalive_interval and timers_holdtime and run apply:

$tofu apply
iosxr_vrf.vrf_TST_VRF_TOM: Refreshing state... [id=Cisco-IOS-XR-um-vrf-cfg:/vrfs/vrf[vrf-name=TST_VRF_TOM]]
iosxr_router_bgp_vrf.router_bgp_vrf_TST_VRF_TOM: Refreshing state... [id=Cisco-IOS-XR-um-router-bgp-cfg:/router/bgp/as[as-number=65003]/vrfs/vrf[vrf-name=TST_VRF_TOM]]

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

OpenTofu will perform the following actions:

  # iosxr_router_bgp_vrf.router_bgp_vrf_TST_VRF_TOM will be updated in-place
  ~ resource "iosxr_router_bgp_vrf" "router_bgp_vrf_TST_VRF_TOM" {
        id            = "Cisco-IOS-XR-um-router-bgp-cfg:/router/bgp/as[as-number=65003]/vrfs/vrf[vrf-name=TST_VRF_TOM]"
      ~ neighbors     = [
          ~ {
              - timers_holdtime           = "20" -> null
              - timers_keepalive_interval = 5 -> null
                # (2 unchanged attributes hidden)
            },
        ]
        # (3 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

iosxr_router_bgp_vrf.router_bgp_vrf_TST_VRF_TOM: Modifying... [id=Cisco-IOS-XR-um-router-bgp-cfg:/router/bgp/as[as-number=65003]/vrfs/vrf[vrf-name=TST_VRF_TOM]]
iosxr_router_bgp_vrf.router_bgp_vrf_TST_VRF_TOM: Still modifying... [id=Cisco-IOS-XR-um-router-bgp-cfg:/router/...=65003]/vrfs/vrf[vrf-name=TST_VRF_TOM], 10s elapsed]
╷
│ Error: Unable to apply gNMI Set operation
│
│   with iosxr_router_bgp_vrf.router_bgp_vrf_TST_VRF_TOM,
│   on main.tf line 23, in resource "iosxr_router_bgp_vrf" "router_bgp_vrf_TST_VRF_TOM":
│   23: resource "iosxr_router_bgp_vrf" "router_bgp_vrf_TST_VRF_TOM" {
│
│ Set request failed, got error: rpc error: code = Internal desc = {
│  "cisco-grpc:errors": {
│   "error": [
│    {
│     "error-type": "protocol",
│     "error-tag": "missing-element",
│     "error-severity": "error",
│     "error-path": "Cisco-IOS-XR-um-router-bgp-cfg:router/bgp/as[as-number = '65003']/vrfs/vrf[vrf-name = 'TST_VRF_TOM']/neighbors/neighbor[neighbor-address = '1.2.3.4']/timers",
│     "error-info": {
│      "bad-element": "keepalive-interval"
│     }
│    }
│   ]
│  }
│ }
│
╵

@tomvrugt
Copy link
Author

tomvrugt commented May 28, 2025

@danischm did you get chance to review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants