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

Expose GET NC list API in CNS client #3449

Merged
merged 9 commits into from
Feb 26, 2025

Conversation

smittal22
Copy link
Contributor

@smittal22 smittal22 commented Feb 24, 2025

Reason for Change:
Expose GET NC list API in CNS client. DNC will call this endpoint to fetch the list of NCs programmed on the node.
In the backend, CNS calls NMAgent's http://%s/machine/plugins/?comp=nmagent&type=NetworkManagement/interfaces/api-version/%s endpoint

Requirements:

Sorry, something went wrong.

@smittal22 smittal22 force-pushed the migration-expose-nc-list-api-for-dnc branch from 4767364 to 5548caa Compare February 24, 2025 20:58
@smittal22 smittal22 changed the title <DO NOT REVIEW> Initial changes to expose getNCList API in CNS client <DO NOT REVIEW> Expose GET NC list API in CNS client Feb 24, 2025
@smittal22 smittal22 self-assigned this Feb 24, 2025
@smittal22 smittal22 added the AZR AZR related PR label Feb 24, 2025
@smittal22
Copy link
Contributor Author

smittal22 commented Feb 24, 2025

/azp run Azure Container Networking PR

Copy link

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@smittal22 smittal22 marked this pull request as ready for review February 24, 2025 21:23
@Copilot Copilot bot review requested due to automatic review settings February 24, 2025 21:23
@smittal22 smittal22 requested review from a team as code owners February 24, 2025 21:23
@smittal22 smittal22 changed the title <DO NOT REVIEW> Expose GET NC list API in CNS client Expose GET NC list API in CNS client Feb 24, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • cns/restserver/restserver.go: Evaluated as low risk
  • nmagent/responses.go: Evaluated as low risk
Comments suppressed due to low confidence (2)

cns/restserver/api.go:1336

  • Use respondJSON instead of common.Encode for consistency: respondJSON(w, http.StatusOK, NCListResponse)
serviceErr := common.Encode(w, &NCListResponse)

cns/restserver/api.go:1308

  • Initialize returnCode with a default value, e.g., returnCode = types.Success
var returnCode types.ResponseCode

@smittal22 smittal22 requested a review from Copilot February 24, 2025 23:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • cns/restserver/restserver.go: Evaluated as low risk
  • nmagent/responses.go: Evaluated as low risk
Comments suppressed due to low confidence (2)

cns/restserver/api_test.go:1327

  • [nitpick] The test case should assert based on the expected behavior of the API. If the list is expected to contain items, adjust the assertion accordingly.
require.Empty(t, nmAgentNCListResponse.NCList)

cns/api.go:31

  • [nitpick] The constant name NMAgentGetNCListAPIPath should be renamed to GetNCListPath to match the existing naming convention.
NMAgentGetNCListAPIPath       = "/nclist"

@smittal22 smittal22 requested a review from Copilot February 24, 2025 23:53
@smittal22 smittal22 enabled auto-merge February 24, 2025 23:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@smittal22 smittal22 force-pushed the migration-expose-nc-list-api-for-dnc branch from adf3752 to ec1b5aa Compare February 25, 2025 19:53
@smittal22
Copy link
Contributor Author

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@smittal22 smittal22 force-pushed the migration-expose-nc-list-api-for-dnc branch from 9cadc8b to 4109319 Compare February 26, 2025 17:00
@smittal22
Copy link
Contributor Author

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@smittal22
Copy link
Contributor Author

CNS log when DNC calls this endpoint:

2025/02/26 20:08:26 [6596] [azure-cns] Received string nmAgentNCListHandler.
2025/02/26 20:08:26 [6596] [azure-cns] Sent *cns.NCListResponse &{Response:{ReturnCode:Success Message:Successfully fetched NC list from NMAgent} NCList:[86fd8b75-94b7-23d8-6ca4-6821b082111f]}.

@smittal22 smittal22 added this pull request to the merge queue Feb 26, 2025
Merged via the queue into master with commit 967efbd Feb 26, 2025
14 checks passed
@smittal22 smittal22 deleted the migration-expose-nc-list-api-for-dnc branch February 26, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AZR AZR related PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants