Skip to content

Commit c851619

Browse files
committed
libyang3 bug: re-order DEVICE_METADATA leaf
For some reason after upgrading to libyang3, tests started throwing these errors: ``` ------------------- Test 247: DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.--------------------- INFO YANG-TEST:test_yang_model.py:193 Verify xpath: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:197 Verify dnode: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:200 Verify path value sonic-device_metadata:default_bgp_status is up in {'sonic-device_metadata:hostname': 'DUT-ASW', 'sonic-device_metadata:platform': 'Stone-DX010', 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:bgp_asn': 65000, 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:synchronous_mode': 'enable', 'sonic-device_metadata:yang_config_validation': 'disable', 'sonic-device_metadata:suppress-fib-pending': 'disabled', 'sonic-device_metadata:timezone': 'UTC', 'sonic-device_metadata:nexthop_group': 'disabled'} ERROR YANG-TEST:test_yang_model.py:29 Exception >assert 'sonic-device_metadata:default_bgp_status' in {'sonic-device_metadata:bgp_asn': 65000, 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:hostname': 'DUT-ASW', ...}< in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:201 ERROR YANG-TEST:test_yang_model.py:29 Exception >DEVICE_METADATA_DEFAULT_BGP_STATUS: Mismatch ['verified'] and < in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:234 INFO YANG-TEST:test_yang_model.py:238 DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD. Failed INFO YANG-TEST:test_yang_model.py:159 ------------------- Test 248: DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.--------------------- INFO YANG-TEST:test_yang_model.py:193 Verify xpath: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:197 Verify dnode: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:200 Verify path value sonic-device_metadata:docker_routing_config_mode is unified in {'sonic-device_metadata:hostname': 'DUT-CSW', 'sonic-device_metadata:platform': 'Stone-DX010', 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:bgp_asn': 65001, 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:synchronous_mode': 'enable', 'sonic-device_metadata:yang_config_validation': 'disable', 'sonic-device_metadata:suppress-fib-pending': 'disabled', 'sonic-device_metadata:timezone': 'UTC', 'sonic-device_metadata:nexthop_group': 'disabled'} ERROR YANG-TEST:test_yang_model.py:29 Exception >assert 'sonic-device_metadata:docker_routing_config_mode' in {'sonic-device_metadata:bgp_asn': 65001, 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:hostname': 'DUT-CSW', ...}< in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:201 ERROR YANG-TEST:test_yang_model.py:29 Exception >DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE: Mismatch ['verified'] and < in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:234 INFO YANG-TEST:test_yang_model.py:238 DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD. Failed INFO YANG-TEST:test_yang_model.py:159 ``` The "fix" is to simply mov those 2 leaf nodes lower in the schema and it fixes the issue. This probably needs to be reported to libyang as the schema appears valid.
1 parent 5730ecf commit c851619

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/sonic-yang-models/yang-models/sonic-device_metadata.yang

+15-15
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module sonic-device_metadata {
3434

3535
description "DEVICE_METADATA part of config_db.json";
3636

37-
container localhost{
37+
container localhost {
3838

3939
leaf hwsku {
4040
type stypes:hwsku;
@@ -47,6 +47,20 @@ module sonic-device_metadata {
4747
description "asic_id is unique identifier of the asic used by SAI for initialization.";
4848
}
4949

50+
leaf hostname {
51+
type stypes:hostname;
52+
}
53+
54+
leaf platform {
55+
type string {
56+
length 1..255;
57+
}
58+
}
59+
60+
leaf mac {
61+
type yang:mac-address;
62+
}
63+
5064
leaf default_bgp_status {
5165
type enumeration {
5266
enum up;
@@ -67,20 +81,6 @@ module sonic-device_metadata {
6781
default "unified";
6882
}
6983

70-
leaf hostname {
71-
type stypes:hostname;
72-
}
73-
74-
leaf platform {
75-
type string {
76-
length 1..255;
77-
}
78-
}
79-
80-
leaf mac {
81-
type yang:mac-address;
82-
}
83-
8484
leaf default_pfcwd_status {
8585
type enumeration {
8686
enum disable;

0 commit comments

Comments
 (0)