Skip to content

[sonic-yang] W/A the feature "state" field validation #9587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,15 @@
"high_mem_alert": "disabled",
"state": "enabled",
"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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"FEATURE_WITH_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" : {
"desc": "Referring invalid feature boolean types.",
"eStrKey": "Pattern",
Expand All @@ -20,4 +15,4 @@
"FEATURE_WITH_NO_OWNER" : {
"desc": "Config feature table without set_owner"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,15 @@
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "kube"
}
]
}
}
},
"FEATURE_WITH_INVALID_STATE": {
"sonic-feature:sonic-feature": {
"sonic-feature:FEATURE": {
"FEATURE_LIST": [
},
{
"name": "database",
"state": "dontcare",
"auto_restart": "always_enabled",
"name": "dhcp_relay",
"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": "disabled",
"has_timer": "false",
"has_global_scope": "true",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "local"
"set_owner": "kube"
}
]
}
Expand Down Expand Up @@ -118,4 +110,4 @@
}
}
}
}
}
6 changes: 2 additions & 4 deletions src/sonic-yang-models/yang-models/sonic-feature.yang
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ module sonic-feature{

typedef feature-state {
description "configuration to set the feature running state";
type string {
pattern "enabled|disabled|always_enabled|always_disabled";
}
type string;
Copy link
Collaborator

@qiluo-msft qiluo-msft Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string

The design of "The feature state can be a jinja template" is weird. What is the motivation? Is it in the design doc? #Pending

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft I haven't found it. It is introduced in #6700. @tahmed-dev Could you please comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft Issue - #9598

}

typedef feature-owner {
Expand Down Expand Up @@ -91,4 +89,4 @@ module sonic-feature{
}
}
}
}
}