You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The init_cfg.json does not pass YANG validation due to:
Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern).
admin@r-boxer-sw01:~$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from config.config_mgmt import ConfigMgmt
>>> mgmt = ConfigMgmt(source='/etc/sonic/init_cfg.json')
Note: Below table(s) have no YANG models:
WJH, WJH_CHANNEL,
libyang[0]: Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the
constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern). (path: /sonic-feature:sonic-feature/FEATURE/FEATURE_LIST[name='dhcp_relay']/state)
sonic_yang(3):Data Loading Failed:Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern).
Data Loading Failed
Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern).
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/sonic_yang_ext.py", line 1065, in loadData
self.root = self.ctx.parse_data_mem(dumps(self.xlateJson), \
File "/usr/lib/python3/dist-packages/yang.py", line 2604, in parse_data_mem
return _yang.Context_parse_data_mem(self, data, format, options)
RuntimeError: Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/config/config_mgmt.py", line 65, in __init__
self.sy.loadData(self.configdbJsonIn)
File "/usr/local/lib/python3.9/dist-packages/sonic_yang_ext.py", line 1072, in loadData
raise SonicYangException("Data Loading Failed\n{}".format(str(e)))
sonic_yang_ext.SonicYangException: Data Loading Failed
Value "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" does not satisfy the constraint "enabled|disabled|always_enabled|always_disabled" (range, length, or pattern).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/config/config_mgmt.py", line 73, in __init__
raise Exception('ConfigMgmt Class creation failed')
Exception: ConfigMgmt Class creation failed
Describe the results you received:
A RuntimeError is thrown due to invalid state field value.
Describe the results you expected:
ConfigMgmt(source='/etc/sonic/init_cfg.json') class creation succedes.
The issue seems from the hack of field in FEATURE table, mux entry's state field in /etc/sonic/init_cfg.json, contains a short json template.
Since the ground truth of DualToR is from minigraph parser, we should manipulate the state in that script. In Yang model, we could enforce that the mux enabled when DualToR, and disabled when not.
Description
The
init_cfg.json
does not pass YANG validation due to:Steps to reproduce the issue:
There is no user interface flow to reproduce it, but it is going to be
sonic-package-manager
(sonic-net/sonic-utilities#1650). With sonic-net/sonic-utilities#1650 the SONiC build will fail due to invalidinit_cfg.json
.Simple steps to reproduce:
Describe the results you received:
A
RuntimeError
is thrown due to invalid state field value.Describe the results you expected:
ConfigMgmt(source='/etc/sonic/init_cfg.json')
class creation succedes.Output of
show version
:Output of
show techsupport
:Additional information you deem important (e.g. issue happens only occasionally):
The text was updated successfully, but these errors were encountered: