Skip to content

Commit 911a072

Browse files
authored
Extended the get_by_type() to support QoS maps. (#259)
Signed-off-by: IGordynskyi <[email protected]>
1 parent 4461567 commit 911a072

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

common/sai.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ def get_by_type(self, obj, attr, attr_type, do_assert=False):
364364
if status == "SAI_STATUS_BUFFER_OVERFLOW":
365365
length = json.loads(data.to_json()[1])["count"]
366366
status, data = self.get(obj, [attr, self.make_map_list(length)], do_assert)
367+
elif attr_type == "sai_qos_map_list_t":
368+
status, data = self.get(obj, [attr, self.make_qos_map_list(1)], do_assert)
369+
if status == "SAI_STATUS_BUFFER_OVERFLOW":
370+
length = json.loads(data.to_json()[1])["count"]
371+
status, data = self.get(obj, [attr, self.make_qos_map_list(length)], do_assert)
367372
elif attr_type == "sai_system_port_config_list_t":
368373
status, data = self.get(obj, [attr, self.make_system_port_config_list(1)], do_assert)
369374
if status == "SAI_STATUS_BUFFER_OVERFLOW":
@@ -439,6 +444,17 @@ def make_map_list(self, length):
439444
}
440445
return json.dumps(attr_value).replace(" ", "")
441446

447+
def make_qos_map_list(self, length):
448+
attr_value = {
449+
"count": length,
450+
"list": [{"key":
451+
{"color":"SAI_PACKET_COLOR_GREEN","dot1p":0,"dscp":0,"fc":0,"mpls_exp":0,"pg":0,"prio":0,"qidx":0,"tc":0},
452+
"value":
453+
{"color":"SAI_PACKET_COLOR_GREEN","dot1p":0,"dscp":0,"fc":0,"mpls_exp":0,"pg":0,"prio":0,"qidx":0,"tc":0}
454+
}] * length
455+
}
456+
return json.dumps(attr_value).replace(" ", "")
457+
442458
def make_system_port_config_list(self, length):
443459
attr_value = {
444460
"count": length,

0 commit comments

Comments
 (0)