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

[Bug]: Dynamic route - String length exceeds maximum [commandString, 711] #1179

Open
reckio123 opened this issue Jul 8, 2024 · 1 comment
Assignees
Labels

Comments

@reckio123
Copy link

reckio123 commented Jul 8, 2024

Terraform Core Version

1.9.1

citrixadc Provider Version

1.39.0

Operating system

Windows

Affected Resource(s)

citrixadc_routerdynamicrouting

Equivalent NetScaler CLI Command

ns route-install default
!
ns route-install bgp
!
bgp extended-asn-cap
!
ip prefix-list PL_DENY_DEFAULT_ROUTE seq 5 deny 0.0.0.0/0
ip prefix-list PL_PERMIT_VIP_NET_ADV seq 5 permit 10.100.200.128/25
!
route-map RM_BGP_ADVERTISE permit 10
match ip address prefix-list PL_PERMIT_VIP_NET_ADV
!
route-map RM_BGP_ADVERTISE deny 15
match ip address prefix-list PL_DENY_DEFAULT_ROUTE
!
router bgp 4205696395
max-paths ebgp 2
bgp graceful-restart
network 10.100.200.128/25
redistribute kernel
neighbor 10.100.250.1 remote-as 4205016395
neighbor 10.100.250.1 fall-over bfd
neighbor 10.100.250.1 soft-reconfiguration inbound
neighbor 10.100.250.1 route-map RM_BGP_ADVERTISE out
neighbor 10.100.250.5 remote-as 4205016395
neighbor 10.100.250.5 fall-over bfd
neighbor 10.100.250.5 soft-reconfiguration inbound
neighbor 10.100.250.5 route-map RM_BGP_ADVERTISE out
!
end

Expected Behavior

The provider should install the bgp routes on the NetScaler appliance

Actual Behavior

The provider is presenting an error to execute because the configuration is longer than 711 characters

Relevant Error/Panic Output Snippet

│ Error: [ERROR] nitro-go: Failed to apply action on resource of type routerdynamicrouting,  action=apply err=failed: 599 Netscaler specific error ({ "errorcode": 1106, "message": "String length exceeds maximum [commandString, 711]", "severity": "ERROR" })  
│
│   with citrixadc_routerdynamicrouting.tf_dynamicrouting,
│   on bgp.tf line 22, in resource "citrixadc_routerdynamicrouting" "tf_dynamicrouting":
│   22: resource "citrixadc_routerdynamicrouting" "tf_dynamicrouting" {

Terraform Configuration Files

# provider
terraform {
  required_providers {
    citrixadc = {
      source  = "citrix/citrixadc"
      version = "1.39.0" 
    }
  }
}

provider "citrixadc" {
  endpoint = "http://192.168.0.48"
  username = "nsroot" # NS_LOGIN env variable
  password = "nsroot123" # NS_PASSWORD env variable
}

# locals {
#     bgp_file = split("\n", chomp(file("bgp.txt")))
# }

resource "citrixadc_routerdynamicrouting" "tf_dynamicrouting" {
    provider = citrixadc
    # commandlines = local.bgp_file
    commandlines = [
        "ns route-install default",
        "!",
        "ns route-install bgp",
        "!",
        "bgp extended-asn-cap",
        "!",
        "ip prefix-list PL_DENY_DEFAULT_ROUTE seq 5 deny 0.0.0.0/0",
        "ip prefix-list PL_PERMIT_VIP_NET_ADV seq 5 permit 10.100.200.128/25",
        "!",
        "route-map RM_BGP_ADVERTISE permit 10",
        "match ip address prefix-list PL_PERMIT_VIP_NET_ADV",
        "!",
        "route-map RM_BGP_ADVERTISE deny 15",
        "match ip address prefix-list PL_DENY_DEFAULT_ROUTE",
        "!",
        "router bgp 4205696395",
        "max-paths ebgp 2",
        "bgp graceful-restart",
        "network 10.100.200.128/25",
        "redistribute kernel",
        "neighbor 10.100.250.1 remote-as 4205016395",
        "neighbor 10.100.250.1 fall-over bfd",
        "neighbor 10.100.250.1 soft-reconfiguration inbound",
        "neighbor 10.100.250.1 route-map RM_BGP_ADVERTISE out",
        "neighbor 10.100.250.5 remote-as 4205016395",
        "neighbor 10.100.250.5 fall-over bfd",
        "neighbor 10.100.250.5 soft-reconfiguration inbound",
        "neighbor 10.100.250.5 route-map RM_BGP_ADVERTISE out",
    ]
}

Steps to Reproduce

terraform apply -auto-approve

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

@reckio123 reckio123 added the bug label Jul 8, 2024
@rohit-myali
Copy link
Contributor

Hey @reckio123
Thanks for raising this issue.

That was the limitation from the NetScaler's resource. There is a threshold max length for the attribute commandlines.

But we have a workaround for the same.

Please split your commandlines and create different resource. Below is the alternative configuration for your above provided configuration.

resource "citrixadc_routerdynamicrouting" "tf_dynamicrouting" {
  # provider = citrixadc
  # commandlines = local.bgp_file
  commandlines = [
    "ns route-install default",
    "!",
    "ns route-install bgp",
    "!",
    "bgp extended-asn-cap",
    "!",
    "ip prefix-list PL_DENY_DEFAULT_ROUTE seq 5 deny [0.0.0.0/0](http://0.0.0.0/0)",
    "ip prefix-list PL_PERMIT_VIP_NET_ADV seq 5 permit [10.100.200.128/25](http://10.100.200.128/25)",
    "!",
    "route-map RM_BGP_ADVERTISE permit 10",
    "match ip address prefix-list PL_PERMIT_VIP_NET_ADV",
    "!",
    "route-map RM_BGP_ADVERTISE deny 15",
    "match ip address prefix-list PL_DENY_DEFAULT_ROUTE",
    "!",
  ]
}
resource "citrixadc_routerdynamicrouting" "tf_dynamicrouting_1" {
  # provider = citrixadc
  # commandlines = local.bgp_file
  commandlines = [
    "router bgp 4205696395",
    "max-paths ebgp 2",
    "bgp graceful-restart",
    "network [10.100.200.128/25](http://10.100.200.128/25)",
    "redistribute kernel",
    "neighbor 10.100.250.1 remote-as 4205016395",
    "neighbor 10.100.250.1 fall-over bfd",
    "neighbor 10.100.250.1 soft-reconfiguration inbound",
    "neighbor 10.100.250.1 route-map RM_BGP_ADVERTISE out",
    "neighbor 10.100.250.5 remote-as 4205016395",
    "neighbor 10.100.250.5 fall-over bfd",
    "neighbor 10.100.250.5 soft-reconfiguration inbound",
    "neighbor 10.100.250.5 route-map RM_BGP_ADVERTISE out",
  ]
}

@rohit-myali rohit-myali self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants