-
Notifications
You must be signed in to change notification settings - Fork 23
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 ip address on interface #548
Conversation
anta/tests/interfaces.py
Outdated
input_secondary_ips = sorted([str(net) for net in command.params["secondary_ips"]]) | ||
|
||
# Check if the interface has an IP address configured | ||
if not (interface_output := get_value(command.json_output, f"interfaces..{intf}..interfaceAddress", separator="..")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to remove separator
anta/tests/interfaces.py
Outdated
class Input(AntaTest.Input): | ||
"""Inputs for the VerifyInterfaceIPv4 test.""" | ||
|
||
interfaces: List[Interfaces] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interfaces: List[Interfaces] | |
interfaces: List[InterfaceDetail] |
anta/tests/interfaces.py
Outdated
"""Name of the interface""" | ||
primary_ip: IPv4Network | ||
"""Primary IPv4 network on interface""" | ||
secondary_ips: List[IPv4Network] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secondary_ips
should be optional. Only check them if they are provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Added testcase to verify ip address(primary and secondary) on interface.
Fixes #545
Expected Results:
* success: The test will pass if an interface is configured with a correct primary and secondary IPv4 address.
* failure: The test will fail if an interface is not found or the primary and secondary IPv4 addresses do not match with the input.
Note: There is no optional input. All the input is required and restricted with values.
Checklist:
pre-commit run
)tox -e testenv
)