[yang] add set_owner to feature yang (#9075)

#### Why I did it
Add the configuration for the set_owner in the `feature` yang model

#### How I did it
Add new leaf `set_pwner` to the `feature` yang model

#### How to verify it
compile `sonic_yang_mgmt-1.0-py3-none-any.whl`
This commit is contained in:
arlakshm 2021-12-09 23:18:45 -08:00 committed by GitHub
parent 325276a917
commit 327ad41bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 89 additions and 23 deletions

View File

@ -1224,7 +1224,8 @@
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled" "state": "enabled",
"set_owner": "local"
}, },
"database": { "database": {
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
@ -1232,7 +1233,8 @@
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "always_enabled" "state": "always_enabled",
"set_owner": "local"
}, },
"snmp": { "snmp": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1240,7 +1242,8 @@
"has_per_asic_scope": "false", "has_per_asic_scope": "false",
"has_timer": "true", "has_timer": "true",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled" "state": "enabled",
"set_owner": "kube"
}, },
"swss": { "swss": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1248,7 +1251,8 @@
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled" "state": "enabled",
"set_owner": "local"
}, },
"syncd": { "syncd": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1256,7 +1260,8 @@
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled" "state": "enabled",
"set_owner": "local"
}, },
"lldp": { "lldp": {
"auto_restart": "enabled", "auto_restart": "enabled",
@ -1264,7 +1269,8 @@
"has_per_asic_scope": "true", "has_per_asic_scope": "true",
"has_timer": "false", "has_timer": "false",
"high_mem_alert": "disabled", "high_mem_alert": "disabled",
"state": "enabled" "state": "enabled",
"set_owner": "kube"
} }
}, },
"DHCP_RELAY": { "DHCP_RELAY": {

View File

@ -5,6 +5,14 @@
"FEATURE_WITH_INVALID_STATE" : { "FEATURE_WITH_INVALID_STATE" : {
"desc": "Referring invalid feature state.", "desc": "Referring invalid feature state.",
"eStrKey": "Pattern", "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"
} }
} }

View File

@ -9,7 +9,8 @@
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "true", "has_global_scope": "true",
"has_per_asic_scope": "true" "has_per_asic_scope": "true",
"set_owner": "local"
}, },
{ {
"name": "swss", "name": "swss",
@ -17,7 +18,8 @@
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true" "has_per_asic_scope": "true",
"set_owner": "local"
}, },
{ {
"name": "syncd", "name": "syncd",
@ -25,7 +27,8 @@
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true" "has_per_asic_scope": "true",
"set_owner": "local"
}, },
{ {
"name": "snmp", "name": "snmp",
@ -33,7 +36,8 @@
"auto_restart": "enabled", "auto_restart": "enabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "true", "has_global_scope": "true",
"has_per_asic_scope": "false" "has_per_asic_scope": "false",
"set_owner": "kube"
}, },
{ {
"name": "lldp", "name": "lldp",
@ -41,7 +45,8 @@
"auto_restart": "disabled", "auto_restart": "disabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "false", "has_global_scope": "false",
"has_per_asic_scope": "true" "has_per_asic_scope": "true",
"set_owner": "kube"
} }
] ]
} }
@ -57,6 +62,40 @@
"auto_restart": "always_enabled", "auto_restart": "always_enabled",
"has_timer": "false", "has_timer": "false",
"has_global_scope": "true", "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" "has_per_asic_scope": "true"
} }
] ]

View File

@ -5,11 +5,22 @@ module sonic-feature{
namespace "http://github.com/Azure/sonic-feature"; namespace "http://github.com/Azure/sonic-feature";
prefix feature; prefix feature;
import sonic-types { description "Feature Table yang Module for SONiC";
prefix stypes;
typedef feature-state {
description "configuration to set the feature running state";
type string {
pattern "enabled|disabled|always_enabled|always_disabled";
}
} }
description "Feature Table yang Module for SONiC OS"; typedef feature-owner {
description "configuration to set if the container is controlled
by kubernetes or locally";
type string {
pattern "kube|local";
}
}
container sonic-feature { container sonic-feature {
@ -30,12 +41,12 @@ module sonic-feature{
leaf state { leaf state {
description "state of the feature"; description "state of the feature";
type stypes:feature_state; type feature-state;
default "enabled"; default "enabled";
} }
leaf auto_restart { leaf auto_restart {
type stypes:feature_state; type feature-state;
default "enabled"; default "enabled";
} }
@ -63,9 +74,16 @@ module sonic-feature{
leaf high_mem_alert { leaf high_mem_alert {
description "This configuration controls the trigger to generate description "This configuration controls the trigger to generate
alert on high memory utilization"; alert on high memory utilization";
type stypes:feature_state; type feature-state;
default "disabled"; default "disabled";
} }
leaf set_owner {
description " This configuration set the feature owner is
kubernetes or local";
type feature-owner;
default "local";
}
} }
} }
} }

View File

@ -197,11 +197,6 @@ module sonic-types {
} }
} }
typedef feature_state {
type string {
pattern "enabled|disabled|always_enabled";
}
}
typedef meter_type { typedef meter_type {
type enumeration { type enumeration {
enum packets; enum packets;