Skip to content

Commit 6738bcd

Browse files
authored
Fix KeyError for unsupported applications in get_host_lane_assignment_option() (sonic-net#566)
1 parent 159a56a commit 6738bcd

File tree

1 file changed

+5
-1
lines changed
  • sonic_platform_base/sonic_xcvr/api/public

1 file changed

+5
-1
lines changed

sonic_platform_base/sonic_xcvr/api/public/cmis.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,11 @@ def get_host_lane_assignment_option(self, appl=1):
10641064
return 0
10651065

10661066
appl_advt = self.get_application_advertisement()
1067-
return appl_advt[appl]['host_lane_assignment_options'] if len(appl_advt) >= appl else 0
1067+
if appl not in appl_advt:
1068+
logger.error('Application {} not found in application advertisement'.format(appl))
1069+
return 0
1070+
1071+
return appl_advt[appl].get('host_lane_assignment_options', 0)
10681072

10691073
def get_media_lane_assignment_option(self, appl=1):
10701074
'''

0 commit comments

Comments
 (0)