Skip to content

Commit

Permalink
error out when invalid LT mode is specified
Browse files Browse the repository at this point in the history
Signed-off-by: Dante Su <dante.su@broadcom.com>
  • Loading branch information
ds952811 committed May 11, 2022
1 parent 5903101 commit 6665a62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/portconfig
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ class portconfig(object):
def set_link_training(self, port, mode):
if self.verbose:
print("Setting link-training %s on port %s" % (mode, port))
if mode not in ['on', 'off']:
mode = 'off'
lt_modes = ['on', 'off']
if mode not in lt_modes:
print('Invalid mode specified: {}'.format(mode))
print('Valid modes: {}'.format(','.join(lt_modes)))
exit(1)
self.db.mod_entry(PORT_TABLE_NAME, port, {PORT_LINK_TRAINING_CONFIG_FIELD_NAME: mode})

def set_autoneg(self, port, mode):
Expand Down

0 comments on commit 6665a62

Please sign in to comment.