sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
741 stars 1.43k forks source link

After onie install with latest sonic-utilities configuration is not loaded into CONFIG_DB resulting in failure to initialize switch #20730

Open dgsudharsan opened 1 week ago

dgsudharsan commented 1 week ago

Description

Issue due to yang validation introduced in the PR https://github.com/sonic-net/sonic-utilities/pull/3576

The config-setup generates a configuration which is not yang aligned. For example loopback and interface tables are defined like below

    "LOOPBACK_INTERFACE": {
        "Loopback0|10.1.0.1/32": {}
    },
   "INTERFACE": {
        "Ethernet0|10.0.0.0/31": {},

While yang expects it to

    "LOOPBACK_INTERFACE": {
        "Loopback0": {},
        "Loopback0|10.1.0.1/32": {}
    },
    "INTERFACE": {
        "Ethernet0": {},
        "Ethernet0|10.0.0.0/31": {},
2024 Nov  8 03:57:59.954048 r-tigris-04 INFO config-setup[3665]: No configuration detected, generating factory default configuration...
2024 Nov  8 03:58:00.299118 r-tigris-04 INFO config-setup[3665]: Reloading existing config db...
2024 Nov  8 03:58:00.617087 r-tigris-04 NOTICE switch_hash: 'reload' executing with command: config reload /etc/sonic/config_db.json -y -n
2024 Nov  8 03:58:00.617004 r-tigris-04 INFO config-setup[4045]: Acquired lock on /etc/sonic/reload.lock
2024 Nov  8 03:58:00.819290 r-tigris-04 INFO config-setup[4045]: libyang[0]: Leafref "../../LOOPBACK_INTERFACE_LIST/name" of value "Loopback0" points to a non-existing leaf. (path: /sonic-loopback-interface:sonic-loopback-interface/LOOPBACK_INTERFACE/LOOPBACK_INTERFACE_IPPREFIX_LIST[name='Loopback0'][ip-prefix='10.1.0.1/32']/name)
2024 Nov  8 03:58:00.819731 r-tigris-04 INFO config-setup[4045]: sonic_yang(3):Data Loading Failed:Leafref "../../LOOPBACK_INTERFACE_LIST/name" of value "Loopback0" points to a non-existing leaf.
2024 Nov  8 03:58:00.819755 r-tigris-04 INFO config-setup[4045]: /etc/sonic/config_db.json fails YANG validation! Error: Data Loading Failed
2024 Nov  8 03:58:00.819775 r-tigris-04 INFO config-setup[4045]: Leafref "../../LOOPBACK_INTERFACE_LIST/name" of value "Loopback0" points to a non-existing leaf.
2024 Nov  8 03:58:00.819800 r-tigris-04 INFO config-setup[4045]: Released lock on /etc/sonic/reload.lock
2024 Nov  8 03:58:00.819868 r-tigris-04 INFO config-setup[4045]: Aborted!
2024 Nov  8 03:58:00.880277 r-tigris-04 INFO config-setup[4372]: True
2024 Nov  8 03:58:00.881941 r-tigris-04 INFO systemd[1]: Finished config-setup.service - Config initialization and migration service.

Steps to reproduce the issue:

1. 2. 3.

Describe the results you received:

Describe the results you expected:

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

dgsudharsan commented 1 week ago

@qiluo-msft @wen587 Can you please prioritize this as this is a regression issue?

qiluo-msft commented 1 week ago

@wen587 , seems "factory default configuration" fails yang validation.

qiluo-msft commented 1 week ago

@dgsudharsan Could you share the /etc/sonic/config_db.json when issue happens?