-
Notifications
You must be signed in to change notification settings - Fork 26
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): Added the test case to verify SNMP user #877
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #877 will not alter performanceComparing Summary
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
8dd61b3
to
1119961
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Quality Gate passedIssues Measures |
class Input(AntaTest.Input): | ||
"""Input model for the VerifySnmpUser test.""" | ||
|
||
users: list[SnmpUser] |
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.
users: list[SnmpUser] | |
snmp_users: list[SnmpUser] |
security_model: SnmpVersion | ||
"""SNMP protocol version..""" | ||
authentication_type: HashingAlgorithms | None = None | ||
"""User authentication settings.""" |
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.
We should give the information here for which version auth and privacy needed
"""SNMP protocol version..""" | ||
authentication_type: HashingAlgorithms | None = None | ||
"""User authentication settings.""" | ||
priv_type: EncryptionAlgorithms | None = None |
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.
priv_type: EncryptionAlgorithms | None = None | |
encryption: EncryptionAlgorithms | None = None |
def validate_inputs(self: BaseModel) -> BaseModel: | ||
"""Validate the inputs provided to the SnmpUser class.""" | ||
if self.security_model in ["v1", "v2c"] and (self.authentication_type or self.priv_type) is not None: | ||
msg = "SNMP versions 1 and 2c, do not support encryption or advanced authentication." |
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.
So we should use the validator in case if a input is required for a case. So i think if a user provide the the version as v3 in that case we should raise the error that encryption and authentication is required.
actual_user_details = {"user group": user_details.get("groupName", "Not Found")} | ||
|
||
if authentication_type: | ||
expected_user_details["authentication type"] = authentication_type |
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.
can you add a unit test for not found params
Description
Verifies the SNMP user configurations for specified version(s).
Fixes #852
Checklist:
pre-commit run
)tox -e testenv
)