Skip to content

Bug: ConfigReload fails when RADIUS statistics are enabled #22407

Open
@anders-nexthop

Description

@anders-nexthop

Is it platform specific

generic

Importance or Severity

Medium

Description of the bug

RADIUS statistics is using an invalid YANG value when statistics are enabled. With a config like the following:
 

admin@usschq-eswdut-t001:~$ show radius
RADIUS global auth_type pap (default)
RADIUS global retransmit 3 (default)
RADIUS global timeout 5 (default)
RADIUS global passkey <EMPTY_STRING> (default)
RADIUS global statistics True <--

 
When a user performs a ConfigSave, and then ConfigReload, the config fails a YANG validation check:

admin@usschq-eswdut-t001:~$ sudo config save -y
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json
admin@usschq-eswdut-t001:~$ sudo config reload -y -f
Acquired lock on /etc/sonic/reload.lock
Disabling container monitoring ...
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
Running command: /usr/local/bin/db_migrator.py -o migrate
libyang[0]: Invalid value "True" in "statistics" element. (path: /sonic-system-radius:sonic-system-radius/RADIUS/global/statistics)
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/sonic_yang_ext.py", line 1176, in loadData
    self.root = self.ctx.parse_data_mem(dumps(self.xlateJson), \
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yang.py", line 2574, in parse_data_mem
    return _yang.Context_parse_data_mem(self, data, format, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Invalid value "True" in "statistics" element.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/config_validator.py", line 44, in <module>
    main()
  File "/usr/local/bin/config_validator.py", line 33, in main
    yang_parser.loadData(configdbJson=config)
  File "/usr/local/lib/python3.11/dist-packages/sonic_yang_ext.py", line 1183, in loadData
    raise SonicYangException("Data Loading Failed\n{}".format(str(e)))
sonic_yang_ext.SonicYangException: Data Loading Failed
Invalid value "True" in "statistics" element.
Traceback (most recent call last):
  File "/usr/local/bin/db_migrator.py", line 1390, in main
    result = getattr(dbmgtr, operation)()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/db_migrator.py", line 1317, in migrate
    self.validate()
  File "/usr/local/bin/db_migrator.py", line 1343, in validate
    assert ret == 0, "Yang validation failed"
           ^^^^^^^^
AssertionError: Yang validation failed
sonic_yang(3):Data Loading Failed:Invalid value "True" in "statistics" element.
Yang validation failed
usage: db_migrator.py [-h] [-o operation migrate, set_version, get_version]
                      [-s unix socket] [-n asic namespace]

options:
  -h, --help            show this help message and exit
  -o operation (migrate, set_version, get_version)
                        operation to perform [default: get_version]
  -s unix socket        the unix socket that the desired database listens on
  -n asic namespace     The asic namespace whose DB instance we need to
                        connect
Released lock on /etc/sonic/reload.lock

The is because the value is set to True rather than the string "true" which YANG expects. See the YANG documentation for details.

Steps to Reproduce

  1. configure radius statistics on dut
    sudo config radius statistics enable
  2. save config
    sudo config save -y
  3. reload config
    sudo config reload

Actual Behavior and Expected Behavior

Actual:

$ sudo config radius statistics enable
$ sudo config save -y
$ sudo config reload <--- fails
... yang error

Expected:

$ sudo config radius statistics enable
$ sudo config save -y
$ sudo config reload <--- succeeds

Relevant log output

Output of show version, show techsupport

admin@usschq-eswdut-t001:~$ show ver

SONiC Software Version: SONiC.sbala-radius_fix_1.0-d4e4cecc3
SONiC OS Version: 12
Distribution: Debian 12.6
Kernel: 6.1.0-22-2-amd64
Build commit: d4e4cecc3
Build date: Wed Jan  1 08:16:39 UTC 2025
Built by: sbala@nxthplinuxser01

Platform: x86_64-accton_as9716_32d-r0
HwSKU: Accton-AS9716-32D
ASIC: broadcom
ASIC Count: 1
Serial Number: 971632D2429019
Model Number: FP5ZZ8632400A
Hardware Revision: N/A
Uptime: 13:41:06 up 1 day, 18:31,  1 user,  load average: 0.30, 0.57, 0.63
Date: Mon 06 Jan 2025 13:41:06

Attach files (if any)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions