Skip to content

Commit

Permalink
Fix qos/test_qos_sai.py (sonic-net#12334)
Browse files Browse the repository at this point in the history
* Regression introduced by: sonic-net#10941

Downlink ports don't have BGP neighbors in case of T0, hence the above change is
causing the key error.

The proposed fix is to modify the testPorts dictionary with peer_addr_ipv6 only if
it is defined.
  • Loading branch information
vivekverma-arista authored Apr 11, 2024
1 parent a6a23dd commit fcd6aee
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,26 +781,32 @@ def __buildTestPorts(self, request, testPortIds, testPortIps, src_port_ids, dst_
if sysMap['port_type'] == sysPorts[port_id]['port_type'] and sport != port_id:
dst_all_sys_port.update({sport: sysMap['system_port']})

return {
testPorts = {
"dst_port_id": dstPort,
"dst_port_ip": dst_test_port_ips[dstPort]['peer_addr'],
"dst_port_ipv6": dst_test_port_ips[dstPort]['peer_addr_ipv6'],
"dst_port_vlan": dstVlan,
"dst_port_2_id": dstPort2,
"dst_port_2_ip": dst_test_port_ips[dstPort2]['peer_addr'],
"dst_port_2_ipv6": dst_test_port_ips[dstPort2]['peer_addr_ipv6'],
"dst_port_2_vlan": dstVlan2,
'dst_port_3_id': dstPort3,
"dst_port_3_ip": dst_test_port_ips[dstPort3]['peer_addr'],
"dst_port_3_ipv6": dst_test_port_ips[dstPort3]['peer_addr_ipv6'],
"dst_port_3_vlan": dstVlan3,
"src_port_id": srcPort,
"src_port_ip": src_port_ip["peer_addr"],
"src_port_ipv6": src_port_ip["peer_addr_ipv6"],
"src_port_vlan": srcVlan,
"dst_sys_ports": dst_all_sys_port
}

if 'peer_addr_ipv6' in dst_test_port_ips[dstPort]:
testPorts.update({"dst_port_ipv6": dst_test_port_ips[dstPort]['peer_addr_ipv6']})
if 'peer_addr_ipv6' in dst_test_port_ips[dstPort2]:
testPorts.update({"dst_port_2_ipv6": dst_test_port_ips[dstPort2]['peer_addr_ipv6']})
if 'peer_addr_ipv6' in dst_test_port_ips[dstPort3]:
testPorts.update({"dst_port_3_ipv6": dst_test_port_ips[dstPort3]['peer_addr_ipv6']})
if 'peer_addr_ipv6' in src_port_ip:
testPorts.update({"src_port_ipv6": src_port_ip["peer_addr_ipv6"]})
return testPorts

def __buildPortSpeeds(self, config_facts):
port_speeds = collections.defaultdict(list)
for etp, attr in config_facts['PORT'].items():
Expand Down

0 comments on commit fcd6aee

Please sign in to comment.