[sonic-yang] fix the feature state type (#9587)
- Why I did it The feature state can be a jinja template, like in this file - https://github.com/Azure/sonic-buildimage/blob/master/files/build_templates/init_cfg.json.j2#L39. Without this change it is not possible to validate a configuration file. - How I did it Relaxes the constraint on feature state. Feature state leaf can be any string. - How to verify it Run UT. Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
This commit is contained in:
parent
36d866002a
commit
13582aaa6d
@ -1280,6 +1280,15 @@
|
|||||||
"high_mem_alert": "disabled",
|
"high_mem_alert": "disabled",
|
||||||
"state": "enabled",
|
"state": "enabled",
|
||||||
"set_owner": "kube"
|
"set_owner": "kube"
|
||||||
|
},
|
||||||
|
"dhcp_relay": {
|
||||||
|
"auto_restart": "enabled",
|
||||||
|
"has_global_scope": "false",
|
||||||
|
"has_per_asic_scope": "true",
|
||||||
|
"has_timer": "false",
|
||||||
|
"high_mem_alert": "disabled",
|
||||||
|
"state": "{% 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 %}",
|
||||||
|
"set_owner": "kube"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DHCP_RELAY": {
|
"DHCP_RELAY": {
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
"FEATURE_WITH_CORRECT_VALUES": {
|
"FEATURE_WITH_CORRECT_VALUES": {
|
||||||
"desc": "CONFIG FEATURE TABLE WITH ALL THE CORRECT VALUES"
|
"desc": "CONFIG FEATURE TABLE WITH ALL THE CORRECT VALUES"
|
||||||
},
|
},
|
||||||
"FEATURE_WITH_INVALID_STATE" : {
|
|
||||||
"desc": "Referring invalid feature state.",
|
|
||||||
"eStrKey": "Pattern",
|
|
||||||
"eStr": ["enabled|disabled|always_enabled|always_disabled"]
|
|
||||||
},
|
|
||||||
"FEATURE_WITH_INVALID_BOOLEAN_TYPE" : {
|
"FEATURE_WITH_INVALID_BOOLEAN_TYPE" : {
|
||||||
"desc": "Referring invalid feature boolean types.",
|
"desc": "Referring invalid feature boolean types.",
|
||||||
"eStrKey": "Pattern",
|
"eStrKey": "Pattern",
|
||||||
|
@ -47,23 +47,15 @@
|
|||||||
"has_global_scope": "false",
|
"has_global_scope": "false",
|
||||||
"has_per_asic_scope": "true",
|
"has_per_asic_scope": "true",
|
||||||
"set_owner": "kube"
|
"set_owner": "kube"
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"FEATURE_WITH_INVALID_STATE": {
|
|
||||||
"sonic-feature:sonic-feature": {
|
|
||||||
"sonic-feature:FEATURE": {
|
|
||||||
"FEATURE_LIST": [
|
|
||||||
{
|
{
|
||||||
"name": "database",
|
"name": "dhcp_relay",
|
||||||
"state": "dontcare",
|
"state": "{% 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 %}",
|
||||||
"auto_restart": "always_enabled",
|
"auto_restart": "disabled",
|
||||||
"has_timer": "false",
|
"has_timer": "false",
|
||||||
"has_global_scope": "true",
|
"has_global_scope": "false",
|
||||||
"has_per_asic_scope": "true",
|
"has_per_asic_scope": "true",
|
||||||
"set_owner": "local"
|
"set_owner": "kube"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,7 @@ module sonic-feature{
|
|||||||
|
|
||||||
typedef feature-state {
|
typedef feature-state {
|
||||||
description "configuration to set the feature running state";
|
description "configuration to set the feature running state";
|
||||||
type string {
|
type string;
|
||||||
pattern "enabled|disabled|always_enabled|always_disabled";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef feature-owner {
|
typedef feature-owner {
|
||||||
|
Loading…
Reference in New Issue
Block a user