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(anta.tests): Added testcase to verify vxlan1 source interface and udp port #554

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

MaheshGSLAB
Copy link
Contributor

Description

Added testcase to verify vxlan1 source interface and udp port.

Fixes #553

Verifies the VXLAN source interface and UDP port.

Expected Results:
  * success: Passes if VXLAN source interface and UDP port are correct.
  * failure: Fails if VXLAN source interface or UDP port are incorrect.
  * skipped: Skips if the Vxlan1 interface is not configured.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have run pre-commit for code linting and typing (pre-commit run)
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (tox -e testenv)

@@ -85,6 +85,12 @@ def bgp_multiprotocol_capabilities_abbreviations(value: str) -> str:
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
VxlanSrcIntf = Annotated[
str,
Field(pattern=r"^(Loopback)[0-9]+$"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As loopback support 0-8191 so need to update the patter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes and please move this to the test itself. I doubt it will be used elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh never mind! I saw you added extra validators.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the custom type. Please take a look once.
@carl-baillargeon

@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review February 6, 2024 08:14
Copy link
Contributor

@carl-baillargeon carl-baillargeon left a comment

Choose a reason for hiding this comment

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

LGTM after minor changes to docstrings and comments.

Thx Mahesh :)

@@ -85,6 +85,12 @@ def bgp_multiprotocol_capabilities_abbreviations(value: str) -> str:
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
VxlanSrcIntf = Annotated[
str,
Field(pattern=r"^(Loopback)[0-9]+$"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes and please move this to the test itself. I doubt it will be used elsewhere.

@@ -85,6 +85,12 @@ def bgp_multiprotocol_capabilities_abbreviations(value: str) -> str:
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
VxlanSrcIntf = Annotated[
str,
Field(pattern=r"^(Loopback)[0-9]+$"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh never mind! I saw you added extra validators.


class VerifyVxlan1ConnSettings(AntaTest):
"""
Verifies the VXLAN source interface and UDP port.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Verifies the VXLAN source interface and UDP port.
Verifies the interface vxlan1 source interface and UDP port.

Verifies the VXLAN source interface and UDP port.

Expected Results:
* success: Passes if VXLAN source interface and UDP port are correct.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* success: Passes if VXLAN source interface and UDP port are correct.
* success: Passes if the interface vxlan1 source interface and UDP port are correct.


Expected Results:
* success: Passes if VXLAN source interface and UDP port are correct.
* failure: Fails if VXLAN source interface or UDP port are incorrect.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* failure: Fails if VXLAN source interface or UDP port are incorrect.
* failure: Fails if the interface vxlan1 source interface or UDP port are incorrect.

"""

name = "VerifyVxlan1ConnSettings"
description = "Verifies the VXLAN source interface and UDP port"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description = "Verifies the VXLAN source interface and UDP port"
description = "Verifies the interface vxlan1 source interface and UDP port."

source_interface: VxlanSrcIntf
"""Source loopback interface of vxlan1 interface"""
udp_port: int = Field(ge=1024, le=65335)
"""UDP port used for vxlan interface"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"""UDP port used for vxlan interface"""
"""UDP port used for vxlan1 interface"""

@@ -23,16 +23,20 @@ def interface_autocomplete(v: str) -> str:

Supported alias:
- `et`, `eth` will be changed to `Ethernet`
- `po` will be changed to `Port-Channel`"""
- `po` will be changed to `Port-Channel`
- `lo`, `lb` will be changed to `Loopback`"""
Copy link
Contributor

Choose a reason for hiding this comment

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

lb is not a valid EOS syntax:

DC1-LEAF1A(config-if-Et1)#int lb 0
% Invalid input
DC1-LEAF1A(config-if-Et1)#int lb0
% Invalid input
DC1-LEAF1A(config-if-Et1)#

Copy link
Contributor

@carl-baillargeon carl-baillargeon left a comment

Choose a reason for hiding this comment

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

LGTM!

@carl-baillargeon carl-baillargeon merged commit ebf1e55 into aristanetworks:main Feb 21, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the testcase to validate Vxlan interface source interface and port
2 participants