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

feat: Add BGP Metrics fields for fabric cloud router routing protocols #794

Merged
merged 4 commits into from
Oct 8, 2024

Conversation

thogarty
Copy link
Contributor

@thogarty thogarty commented Oct 4, 2024

  • Added additional optional fields to routing protocols bgp_ipv4 and bgp_ipv6 objects
  • Included acceptance testing

Acceptance Tests for Fabric will be failing intermittently because in UAT the Vlan Tags are not being released quickly (or possibly at all). I've included evidence of local passing tests in a screenshot below:

image

srushti-patl
srushti-patl previously approved these changes Oct 4, 2024
Copy link
Contributor

@srushti-patl srushti-patl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Need to fix Lint Validation and Go build

@@ -712,6 +748,16 @@ func routingProtocolBgpIpv4TerraformToGo(routingProtocolBgpIpv4Request []interfa
enabled := bgpIpv4Map["enabled"].(bool)
rpBgpIpv4.SetEnabled(enabled)

if outboundAsPrependCount := bgpIpv4Map["outbound_as_prepend_count"].(int); outboundAsPrependCount > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thogarty Are we checking this condition outboundAsPrependCount > 0 to validate that its in this range - 0, 1, 3, 7 (wiki)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that 0 won't be included then. Is there a different reason for outboundAsPrependCount > 0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good find on the wiki. This creates a problem though. SDKv2 always assigns the zero value of the type and doesn't have the concept of null for an unassigned value. Zero value for int is always 0, and I wasn't trying to avoid sending the value in the API request if the user didn't explicitly include it in the config.

Might have to rework how we can handle this case in SDKv2; or we don't support this feature until we can move to terraform-plugin-framework.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a plan that can work though. We can use strings for these values and convert internally during mapping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could work.

In that case, if it's a string "0" (in SDKv2) it would mean an actual value of outboundAsPrependCount and if it is int 0, then it would mean 0 (for unassigned value/null).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me rethink this.

You said we can use strings and convert during mapping, but then what about int 0 values (unassigned values)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I understood how you can implement this in the code.

@thogarty
Copy link
Contributor Author

thogarty commented Oct 5, 2024

@d-bhola , updated it to string type to account for user possibly not adding the parameter and to account for allowing the user to choose zero explicitly.

New test run after changes:
Screenshot 2024-10-04 at 6 44 28 PM

Copy link
Contributor

@srushti-patl srushti-patl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thogarty thogarty merged commit c4df27a into main Oct 8, 2024
8 of 11 checks passed
@thogarty thogarty deleted the routing_protocol_bgp_metrics branch October 8, 2024 18:04
Copy link

This PR is included in version 2.7.0 🎉

srushti-patl pushed a commit that referenced this pull request Oct 28, 2024
#794)

* Added additional optional fields to routing protocols bgp_ipv4 and
bgp_ipv6 objects
* Included acceptance testing

Acceptance Tests for Fabric will be failing intermittently because in
UAT the Vlan Tags are not being released quickly (or possibly at all).
I've included evidence of local passing tests in a screenshot below:

<img width="1227" alt="image"
src="https://github.com/user-attachments/assets/74c340b8-7957-4dcf-88d2-ba2cdd8147b2">
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.

3 participants