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

Add gnmi test for smartswitch #16053

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ganglyu
Copy link
Contributor

@ganglyu ganglyu commented Dec 13, 2024

Description of PR

Summary:
Fixes # (issue)
Microsoft ADO: 28940620

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

Add gnmi end to end test for smartswitch

How did you do it?

Use GNMI to update the DASH_VNET_TABLE, and use redis cli to verify the DASH_VNET_TABLE in APPL_DB.
Only run test for smartswitch device.

How did you verify/test it?

Run gnmi end to end test

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ganglyu ganglyu requested review from liuh-80 and Copilot December 13, 2024 03:15

Choose a reason for hiding this comment

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

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

@@ -96,6 +96,7 @@ def apply_cert_config(duthost):
dut_command += "--config_table_name GNMI_CLIENT_CERT "
dut_command += "--client_auth cert "
dut_command += "--enable_crl=true "
dut_command += "--zmq_address=tcp://127.0.0.1:8100 "
Copy link
Contributor

@qiluo-msft qiluo-msft Dec 13, 2024

Choose a reason for hiding this comment

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

zmq_address

Is it possible that this function will run on a platform without zmq? If yes, we need to conditionally use --zmq_address parameter. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

result = duthost.shell("show chassis module status")
for line in result['stdout_lines']:
module_status = line.split()
if "Online" in module_status:
Copy link
Contributor

Choose a reason for hiding this comment

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

module_status

This check is risky. Suggest

  1. parse the table header line to get all the columns' names
  2. get the index of expected column
  3. loop all the remaining lines, check the expected column which have exact match of "Online"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please initialize name_idx, oper_status_idx to something (like NULL) before the loop, and check valid values after the loop.

I understand the python code is working, but not robust, and easy to trigger bug, if there is global variable with the same names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

redis_port = data['INSTANCES']['redis']['port']
file_name = "vnet.txt"
vni = "1000"
guid = "559c6ce8-26ab-4193-b946-ccc6e8f930b2"
Copy link
Contributor

@qiluo-msft qiluo-msft Dec 13, 2024

Choose a reason for hiding this comment

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

559c6ce8

How did you get this guid string? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I use uuid to generate guid.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ganglyu ganglyu requested a review from qiluo-msft December 13, 2024 05:26
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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