-
Notifications
You must be signed in to change notification settings - Fork 737
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
Fix for passing snappi api credentials #12135
Conversation
@developfast can you please approve this PR |
location = "https://" + snappi_api_serv_ip + ":" + str(snappi_api_serv_port) | ||
# TODO: Currently extension is defaulted to ixnetwork. | ||
# Going forward, we should be able to specify extension | ||
# from command line while running pytest. | ||
api = snappi.api(location=location, ext="ixnetwork") | ||
|
||
api._username = duthost.host.options['variable_manager'].\ | ||
_hostvars[duthost.hostname]['secret_group_vars']['snappi_api_server']['user'] |
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.
@selldinesh :
No need for "secret_group_vars". It gives KeyError.
We can directly use:
_hostvars[duthost.hostname]['snappi_api_server']['user'].
Same for password.
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.
After doing this change, this is able to work.
Hi @developfast , |
@vmittal-msft : for viz. |
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
* passing non default password from snappi-sonic.yml file * passing non default password from snappi-sonic.yml file * commenting the username and paswword block * removing duthost
Cherry-pick PR to 202405: #13286 |
* passing non default password from snappi-sonic.yml file * passing non default password from snappi-sonic.yml file * commenting the username and paswword block * removing duthost
Description of PR
Summary: This pr adds a way of passing credentials for snappi_api based on snappi-sonic.yml file
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
To pass username and password for snappi api
How did you do it?
Fetches the username and password from ansible/group_vars/snappi_sonic/snappi-sonic.yml file
How did you verify/test it?
Tested on linux api server
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation