[yang] Feature yang changes (#7955)
Why I did it Add yang model for Feature configuration How I did it Add feature.yang and unit tests Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This commit is contained in:
parent
b7d49b0a0c
commit
34267393b3
@ -53,6 +53,7 @@ setup(
|
||||
'./yang-models/sonic-device_neighbor.yang',
|
||||
'./yang-models/sonic-extension.yang',
|
||||
'./yang-models/sonic-flex_counter.yang',
|
||||
'./yang-models/sonic-feature.yang',
|
||||
'./yang-models/sonic-interface.yang',
|
||||
'./yang-models/sonic-loopback-interface.yang',
|
||||
'./yang-models/sonic-mgmt_interface.yang',
|
||||
|
@ -1088,8 +1088,57 @@
|
||||
"mode": "TRANSMIT",
|
||||
"enabled": "true"
|
||||
}
|
||||
},
|
||||
"FEATURE": {
|
||||
"bgp": {
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled"
|
||||
},
|
||||
"database": {
|
||||
"auto_restart": "always_enabled",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "always_enabled"
|
||||
},
|
||||
"snmp": {
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "false",
|
||||
"has_timer": "true",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled"
|
||||
},
|
||||
"swss": {
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled"
|
||||
},
|
||||
"syncd": {
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled"
|
||||
},
|
||||
"lldp": {
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"SAMPLE_CONFIG_DB_UNKNOWN": {
|
||||
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
{
|
||||
"FEATURE_WITH_CORRECT_VALUES": {
|
||||
"sonic-feature:sonic-feature": {
|
||||
"sonic-feature:FEATURE": {
|
||||
"FEATURE_LIST": [
|
||||
{
|
||||
"name": "database",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "true"
|
||||
},
|
||||
{
|
||||
"name": "swss",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true"
|
||||
},
|
||||
{
|
||||
"name": "syncd",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true"
|
||||
},
|
||||
{
|
||||
"name": "snmp",
|
||||
"state": "enabled",
|
||||
"auto_restart": "enabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "false"
|
||||
},
|
||||
{
|
||||
"name": "lldp",
|
||||
"state": "disabled",
|
||||
"auto_restart": "disabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"FEATURE_WITH_INVALID_STATE": {
|
||||
"sonic-feature:sonic-feature": {
|
||||
"sonic-feature:FEATURE": {
|
||||
"FEATURE_LIST": [
|
||||
{
|
||||
"name": "database",
|
||||
"state": "dontcare",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
72
src/sonic-yang-models/yang-models/sonic-feature.yang
Normal file
72
src/sonic-yang-models/yang-models/sonic-feature.yang
Normal file
@ -0,0 +1,72 @@
|
||||
module sonic-feature{
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-feature";
|
||||
prefix feature;
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
}
|
||||
|
||||
description "Feature Table yang Module for SONiC OS";
|
||||
|
||||
container sonic-feature {
|
||||
|
||||
container FEATURE {
|
||||
|
||||
description "feature table in config_db.json";
|
||||
|
||||
list FEATURE_LIST {
|
||||
|
||||
key "name";
|
||||
|
||||
leaf name {
|
||||
description "feature name in Feature table";
|
||||
type string {
|
||||
length 1..32;
|
||||
}
|
||||
}
|
||||
|
||||
leaf state {
|
||||
description "state of the feature";
|
||||
type stypes:feature_state;
|
||||
default "enabled";
|
||||
}
|
||||
|
||||
leaf auto_restart {
|
||||
type stypes:feature_state;
|
||||
default "enabled";
|
||||
}
|
||||
|
||||
leaf has_timer {
|
||||
description "This configuration identicates if there is
|
||||
timer associated to this feature";
|
||||
type boolean;
|
||||
default false;
|
||||
}
|
||||
|
||||
leaf has_global_scope {
|
||||
description "This configuration identicates there will only one service
|
||||
spawned for the device";
|
||||
type boolean;
|
||||
default false;
|
||||
}
|
||||
|
||||
leaf has_per_asic_scope {
|
||||
description "This configuration identicates there will only one service
|
||||
spawned per asic";
|
||||
type boolean;
|
||||
default false;
|
||||
}
|
||||
|
||||
leaf high_mem_alert {
|
||||
description "This configuration controls the trigger to generate
|
||||
alert on high memory utilization";
|
||||
type stypes:feature_state;
|
||||
default "disabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -160,6 +160,11 @@ module sonic-types {
|
||||
}
|
||||
}
|
||||
|
||||
typedef feature_state {
|
||||
type string {
|
||||
pattern "enabled|disabled|always_enabled";
|
||||
}
|
||||
}
|
||||
typedef meter_type {
|
||||
type enumeration {
|
||||
enum packets;
|
||||
|
Reference in New Issue
Block a user