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 Apr 22, 2022
1 parent ef57ac3 commit 628f68b
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 628f68b

Please sign in to comment.