Skip to content

[yang] add set_owner to feature yang #9075

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 6 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
18 changes: 12 additions & 6 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1096,47 +1096,53 @@
"has_per_asic_scope": "true",
"has_timer": "false",
"high_mem_alert": "disabled",
"state": "enabled"
"state": "enabled",
"set_owner": "local"
},
"database": {
"auto_restart": "always_enabled",
"has_global_scope": "true",
"has_per_asic_scope": "true",
"has_timer": "false",
"high_mem_alert": "disabled",
"state": "always_enabled"
"state": "always_enabled",
"set_owner": "local"
},
"snmp": {
"auto_restart": "enabled",
"has_global_scope": "true",
"has_per_asic_scope": "false",
"has_timer": "true",
"high_mem_alert": "disabled",
"state": "enabled"
"state": "enabled",
"set_owner": "kube"
},
"swss": {
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"high_mem_alert": "disabled",
"state": "enabled"
"state": "enabled",
"set_owner": "local"
},
"syncd": {
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"high_mem_alert": "disabled",
"state": "enabled"
"state": "enabled",
"set_owner": "local"
},
"lldp": {
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"high_mem_alert": "disabled",
"state": "enabled"
"state": "enabled",
"set_owner": "kube"
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
"FEATURE_WITH_INVALID_STATE" : {
"desc": "Referring invalid feature state.",
"eStrKey": "Pattern",
"eStr": ["enabled|disabled|always_enabled"]
"eStr": ["enabled|disabled|always_enabled|always_disabled"]
},
"FEATURE_WITH_INVALID_OWNER" : {
"desc": "Referring invalid feature set_owner field.",
"eStrKey": "Pattern",
"eStr": ["kube|local"]
},
"FEATURE_WITH_NO_OWNER" : {
"desc": "Config feature table without set_owner"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,44 @@
"auto_restart": "always_enabled",
"has_timer": "false",
"has_global_scope": "true",
"has_per_asic_scope": "true"
"has_per_asic_scope": "true",
"set_owner": "local"
},
{
"name": "swss",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true"
"has_per_asic_scope": "true",
"set_owner": "local"
},
{
"name": "syncd",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true"
"has_per_asic_scope": "true",
"set_owner": "local"
},
{
"name": "snmp",
"state": "enabled",
"auto_restart": "enabled",
"has_timer": "false",
"has_global_scope": "true",
"has_per_asic_scope": "false"
"has_per_asic_scope": "false",
"set_owner": "kube"
},
{
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true"
"has_per_asic_scope": "true",
"set_owner": "kube"
}
]
}
Expand All @@ -57,6 +62,40 @@
"auto_restart": "always_enabled",
"has_timer": "false",
"has_global_scope": "true",
"has_per_asic_scope": "true",
"set_owner": "local"
}
]
}
}
},
"FEATURE_WITH_INVALID_OWNER": {
"sonic-feature:sonic-feature": {
"sonic-feature:FEATURE": {
"FEATURE_LIST": [
{
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "invalid"
}
]
}
}
},
"FEATURE_WITH_NO_OWNER": {
"sonic-feature:sonic-feature": {
"sonic-feature:FEATURE": {
"FEATURE_LIST": [
{
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true"
}
]
Expand Down
27 changes: 21 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-feature.yang
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ module sonic-feature{
namespace "http://github.com/Azure/sonic-feature";
prefix feature;

import sonic-types {
prefix stypes;
description "Feature Table yang Module for SONiC";

typedef feature-state {
type string {
pattern "enabled|disabled|always_enabled|always_disabled";
}
}

description "Feature Table yang Module for SONiC OS";
typedef feature-owner {
type string {
pattern "kube|local";
}
}

container sonic-feature {

Expand All @@ -30,12 +38,12 @@ module sonic-feature{

leaf state {
description "state of the feature";
type stypes:feature_state;
type feature-state;
default "enabled";
}

leaf auto_restart {
type stypes:feature_state;
type feature-state;
default "enabled";
}

Expand Down Expand Up @@ -63,9 +71,16 @@ module sonic-feature{
leaf high_mem_alert {
description "This configuration controls the trigger to generate
alert on high memory utilization";
type stypes:feature_state;
type feature-state;
default "disabled";
}

leaf set_owner {
description " This configuration set the feature owner is
kubernetes or local";
type feature-owner;
default "local";
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/sonic-yang-models/yang-models/sonic-types.yang
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ module sonic-types {
}
}

typedef feature_state {
type string {
pattern "enabled|disabled|always_enabled";
}
}
typedef meter_type {
type enumeration {
enum packets;
Expand Down