Skip to content

DPU test cases with GNMI and Protobuf#9238

Merged
Pterosaur merged 18 commits intosonic-net:masterfrom
Pterosaur:protobuf_dash
Sep 27, 2023
Merged

DPU test cases with GNMI and Protobuf#9238
Pterosaur merged 18 commits intosonic-net:masterfrom
Pterosaur:protobuf_dash

Conversation

@Pterosaur
Copy link
Copy Markdown
Contributor

@Pterosaur Pterosaur commented Aug 2, 2023

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

  1. Add new topology DPU to Azp
  2. Port exiting DASH test cases to support GNMI and protobuf changes

How did you do it?

  1. Enable a new job for DPU
  2. Replace the original interface ,swssconfig, to 'gnmi client'
  3. Convert json format to protobuf

How did you verify/test it?

  1. Check Azp

Any platform specific information?

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

Documentation

@Pterosaur Pterosaur changed the title Protobuf for dash test [Draft]: Protobuf for dash test Aug 2, 2023
Signed-off-by: Ze Gan <ganze718@gmail.com>
@qiluo-msft qiluo-msft requested review from ganglyu and zbud-msft August 7, 2023 06:33
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
@sonic-net sonic-net deleted a comment from mssonicbld Sep 5, 2023
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Ze Gan <ganze718@gmail.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Pterosaur
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Pterosaur Pterosaur changed the title [Draft]: Protobuf for dash test DPU test cases with GNMI and Protobuf Sep 26, 2023
@Pterosaur Pterosaur marked this pull request as ready for review September 26, 2023 10:17
def json_to_proto(key, json_obj):
table_name = re.search(r"DASH_(\w+)_TABLE", key).group(1)
if table_name == "APPLIANCE":
pb = Appliance()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest splitting the implementation of json_to_proto and making it more generic, so it will be easier to add support for the new objects in the future:

def appliance_from_json(json_obj):
    pb = Appliance()
    pb.sip.ipv4 = socket.htonl(int(ipaddress.IPv4Address(json_obj["sip"])))
    pb.vm_vni = int(json_obj["vm_vni"])
    return pb

def vnet_from_json(json_obj):
    pb = Vnet()
    pb.vni = int(json_obj["vni"])
    pb.guid.value = bytes.fromhex(uuid.UUID(json_obj["guid"]).hex)
    return pb

handlers_map = {
    "DASH_APPLIANCE": appliance_from_json,
    "DASH_VNET": vnet_from_json
}

def json_to_proto(key, json_obj):
    table, row = key.split(TABLE_NAME_SEPARATOR, 1)
    if table not in handlers_map:
        raise RuntimeError(f"Unknown DASH table: {table}")

    return handlers_map[table](json_obj)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

logger.info("Invalid operation %s" % operation["OP"])
ret, msg = gnmi_set(duthost, ptfhost, delete_list, update_list, [])
assert ret == 0, msg
time.sleep(5)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need to sleep here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GNMI will update APPL_DB, and orchagent can't invoke SAI immediately.
We have to wait a few seconds to verify dataplane.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the future, we will have a feedback loop so that we don't need to sleep but need to wait for a dedicated event

Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
ganglyu
ganglyu previously approved these changes Sep 27, 2023
@Pterosaur Pterosaur merged commit 5ea2dc6 into sonic-net:master Sep 27, 2023
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
What is the motivation for this PR?
Add new topology DPU to Azp
Port exiting DASH test cases to support GNMI and protobuf changes
How did you do it?
Enable a new job for DPU
Replace the original interface ,swssconfig, to 'gnmi client'
Convert json format to protobuf
How did you verify/test it?
Check Azp
---------

Signed-off-by: Ze Gan <ganze718@gmail.com>
Co-authored-by: ganglyu <ganglv@microsoft.com>
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.

5 participants