Skip to content

Random failures of TestResourceFreeformAggregateLink() #1230

@chrismarget-j

Description

@chrismarget-j

The TestResourceFreeformAggregateLink() test occasionally produces failures like:

        Error: Failed updating Freeform Aggregate Link
        
          with apstra_freeform_aggregate_link.multi-headed,
          on terraform_plugin_test.tf line 16, in resource "apstra_freeform_aggregate_link" "multi-headed":
          16: resource "apstra_freeform_aggregate_link" "multi-headed" {
        
        {"api_response":null,"config_blueprint_version":0,"errors":{"if_name":"Interface
        if_name ae87 already exists on system node 7AoKRC1FY2owr8slvi8 (G1-S1) with
        interface ID EeWw06ZeReDCqbv0ozE"},"error_code":422}

I suspect this happens because randomly assigned aggregate interface names collide, either within a single test case, or across multiple test cases running in parallel.

Explore using fixed interface values (ae11, ae12, ae13...) or random values from within separate ranges (ae10-19, ae20-29, ae30-39...)

The issue seems to be related to using the same interface name (e.g. "ae10") in our initial POST as we use in a follow-up PATCH. This doesn't happen very often because the ae names re chosen randomly.

When it does happen, the system seems to assume we're trying to create a new interface, rather than patch the value of the existing one unless we specify the id in the payload.

For example, if we send this payload with PATCH:

{ 
  "endpoints": [
    {
      "system": {
        "id": "YvUdz48efN9v4frXPw"
      },
      "interface": {
        "id": "RA5aaTLyl1M5gb6elw",
        "if_name": "ae1",
        "port_channel_id": 1,
        "lag_mode": "lacp_active"
      },
      "endpoint_group": 0
    },
    {
      "system": {
        "id": "0Nfxc4QVW1ISTMQYAA"
      },
      "interface": {
        "id": "m4f0YjzMwkKJmQyGpQ",
        "if_name": "ae1",
        "port_channel_id": 1,
        "lag_mode": "lacp_active"
      },
      "endpoint_group": 1
    }
  ],
  "member_link_ids": [
    "HSetWo2r08tK7Bsa_g"
  ]
} 

And then follow up with another PATCH using the same payload, but without the interface ID:

{ 
  "endpoints": [
    {
      "system": {
        "id": "YvUdz48efN9v4frXPw"
      },
      "interface": {
        "if_name": "ae1",
        "port_channel_id": 1,
        "lag_mode": "lacp_active"
      },
      "endpoint_group": 0
    },
    {
      "system": {
        "id": "0Nfxc4QVW1ISTMQYAA"
      },
      "interface": {
        "if_name": "ae1",
        "port_channel_id": 1,
        "lag_mode": "lacp_active"
      },
      "endpoint_group": 1
    }
  ],
  "member_link_ids": [
    "HSetWo2r08tK7Bsa_g"
  ]
} 

We get this error:

{
  "errors": {
    "if_name": "Interface if_name ae1 already exists on system node YvUdz48efN9v4frXPw (sys-001) with interface ID RA5aaTLyl1M5gb6elw",
    "port_channel_id": "Interface with such port channel ID already exists on system sys-001"
  }
}

Easy workaround would be to prohibit changing the if_name and port_channel_id attributes via the RequiresReplace plan modifier.

Alternately, we can save the interface ID and re-send it on Update().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions