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

Feature add uname pw config param #18

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

SColson82
Copy link
Collaborator

Add optional http_username and http_password parameters to sdx_client constructor class.
Add getters and setters for both.
Adjust post, patch, get, delete methods to account for these.
Adjust post, patch, get, delete unit tests to account for these.
Add unit tests for new parameters.
Add test variables for each to test_config file.

Copy link
Collaborator

@italovalcy italovalcy left a comment

Choose a reason for hiding this comment

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

Hi @SColson82 great work adding the authentication capability to sdx-lib! Very nice to see how this is shaping up and also a very important feature. Just left two comments:

  1. Check my comment about passing none values directly to requests lib, which already does some validation on that direction so your code can be simplified
  2. Please check this line here:
    response = requests.get(topology_url, timeout=10)
    I believe that request call should also be updated to include the authentication parameters, no?

thanks and congratulations again!

sdxlib/sdx_client.py Outdated Show resolved Hide resolved
@SColson82 SColson82 requested a review from italovalcy January 17, 2025 15:04
Copy link
Collaborator

@italovalcy italovalcy left a comment

Choose a reason for hiding this comment

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

Hi @SColson82 excellent work!! Just left another comment, which if accepted also applies for all other usage cases!

@@ -517,7 +547,9 @@ def create_l2vpn(self) -> SDXResponse:
return SDXResponse(response_json)

try:
response = requests.post(url, json=payload, timeout=120)
# Include authentication if username and password are provided.
auth = (self._http_username, self._http_password)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @SColson82 since you are using the attribute (self._http_username and self._http_password) instead of the property (self.http_password), I wonder if the property is really necessary. Maybe you change all the usage of those attributes to refer to the property. I mean:

Suggested change
auth = (self._http_username, self._http_password)
auth = (self.http_username, self.http_password)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @SColson82 @italovalcy, excellent initiative; please take a look here:

https://docs.google.com/document/d/1oRfxWk1q560OY-Seo5_ZVCuYWNc9zwmC4LseEHrMVuI/edit?tab=t.0

Feel free to adapt the code and documentation based on the specifications.

Page 6: FABRIC, OpenID Connect (OIDC), and SDX-Lib

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @lmarinve! The http_username and http_password properties are meant to be a stop gap measure to address an issue that Italo and Jeronimo experienced on the SC floor. I have created issue #19 - Add more sophisticated way of authenticating - to address the more sophisticated way of authenticating once that is in place.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@SColson82 can you please double check the points I mentioned before about the usage of private attributes versus getter/property function?

@SColson82 SColson82 requested a review from italovalcy January 22, 2025 13:51
Copy link
Collaborator

@italovalcy italovalcy left a comment

Choose a reason for hiding this comment

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

@SColson82 left a comment regarding the usage of private attributes versus property/getter function

@@ -517,7 +547,9 @@ def create_l2vpn(self) -> SDXResponse:
return SDXResponse(response_json)

try:
response = requests.post(url, json=payload, timeout=120)
# Include authentication if username and password are provided.
auth = (self._http_username, self._http_password)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SColson82 can you please double check the points I mentioned before about the usage of private attributes versus getter/property function?

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