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

Feature: optional speed input for resource apstra_datacenter_generic_system.links #173

Open
kimcharli opened this issue Jun 29, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@kimcharli
Copy link

The resource apstra_datacenter_generic_system.links requires target_switch_if_transform_id which is foreign to the users. It would be more user-friendly to accept speed, like speed 10g, instead of transform_id 2.

The transform_id can be deduced from the device profile with the interface name and the speed. Only in the cases when the speed is not unique for the interface, the transform_id can (should) be provided in addition to the speed.

@chrismarget-j
Copy link
Collaborator

Hi Charlie,

Thank you for opening this issue!

(I'm fully enumerating the context below so we'll have a record of what we did and why)

There are cases where two different transform IDs yield the same speed. For example, the Cisco_3172PQ_NXOS device profile has these two:

{
  "is_default": true,
  "interfaces": [
    {
      "state": "active",
      "setting": "{\"interface\": {\"speed\": \"\"}, \"global\": {\"port_index\": -1, \"speed\": \"\", \"module_index\": -1}}",
      "speed": {
        "unit": "G",
        "value": 10
      },
      "name": "Ethernet1/1",
      "interface_id": 1
    }
  ],
  "transformation_id": 1
}

...and...

{
  "is_default": false,
  "interfaces": [
    {
      "state": "active",
      "setting": "{\"interface\": {\"speed\": \"10000\"}, \"global\": {\"port_index\": -1, \"speed\": \"\", \"module_index\": -1}}",
      "speed": {
        "unit": "G",
        "value": 10
      },
      "name": "Ethernet1/1",
      "interface_id": 1
    }
  ],
  "transformation_id": 2
}

In the case of apstra_interface_map resource, the transformation_id attribute is optional. We use the logical device interface details (which include speed) to auto-select the transformation when it is possible to do so. When there are multiple choices we produce an error indicating the user must select a transformation.

We can implement similar logic here:

  • Introduce a new target_switch_if_speed link attribute
  • organize input validation so that exactly one of target_switch_if_speed and transformation_id is required (allowing both introduces possible exception cases which can be easily avoided)
  • collect the target switch device profile (along with some provider-managed cache to speed things up) when the user specifies the speed rather than the transformation
  • error with a message indicating that a transformation ID must be selected when more than one transformation supports the desired speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants