-
Notifications
You must be signed in to change notification settings - Fork 717
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
DPU test cases with GNMI and Protobuf #9238
Conversation
d32e19d
to
f855186
Compare
Signed-off-by: Ze Gan <ganze718@gmail.com>
f855186
to
6d4abba
Compare
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>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
Signed-off-by: Ze Gan <ganze718@gmail.com>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Ze Gan <ganze718@gmail.com>
a46ede3
to
20bece8
Compare
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
tests/dash/gnmi_utils.py
Outdated
def json_to_proto(key, json_obj): | ||
table_name = re.search(r"DASH_(\w+)_TABLE", key).group(1) | ||
if table_name == "APPLIANCE": | ||
pb = Appliance() |
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.
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)
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.
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) |
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.
Why do we need to sleep here?
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.
GNMI will update APPL_DB, and orchagent can't invoke SAI immediately.
We have to wait a few seconds to verify dataplane.
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.
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>
f1d4a03
to
e5ed46d
Compare
This reverts commit f1d4a03.
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>
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
How did you do it?
How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation