Skip to content
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

Feature yang changes #7955

Merged
merged 6 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'./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',
Expand Down
50 changes: 50 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 @@ -907,6 +907,56 @@
"PREFIX": {
"prefix1|1|10.0.0.0/8|8..16": {
}
},
"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"
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
},
"lldp": {
"auto_restart": "enabled",
"has_global_scope": "False",
"has_per_asic_scope": "True",
"has_timer": "False",
"high_mem_alert": "disabled",
"state": "enabled"
}
}
},

Expand Down
10 changes: 10 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/feature.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
Original file line number Diff line number Diff line change
@@ -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_asic_scope": true
},
{
"name": "swss",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": false,
"has_global_scope": false,
"has_asic_scope": true
},
{
"name": "syncd",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": false,
"has_global_scope": false,
"has_asic_scope": true
},
{
"name": "snmp",
"state": "enabled",
"auto_restart": "enabled",
"has_timer": false,
"has_global_scope": true,
"has_asic_scope": false
},
{
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": false,
"has_global_scope": false,
"has_asic_scope": true
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
}
},
"FEATURE_WITH_INVALID_STATE": {
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
"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_asic_scope": true
}
]
}
}
}
}
71 changes: 71 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-feature.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module sonic-feature{

yang-version 1.1;

namespace "http://github.com/Azure/sonic-feature";
prefix port;
arlakshm marked this conversation as resolved.
Show resolved Hide resolved

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;
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
}
}

leaf state {
description "state of the feature";
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
type stypes:feature_state;
}

leaf auto_restart {
type stypes:feature_state;

}

leaf has_timer {
description "This configuration identicates if there is
timer associated to this feature";
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
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_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;
Copy link
Contributor

Choose a reason for hiding this comment

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

@arlakshm does always_enabled applies for high_mem_alert ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@arlakshm does always_enabled applies for high_mem_alert ?

I think it is OK to let high_mem_alert support the option always_enabled.

default "disabled";
}
arlakshm marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}
6 changes: 6 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-types.yang
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,10 @@ module sonic-types {
pattern "0x8100|0x9100|0x9200|0x88a8|0x88A8";
}
}

typedef feature_state {
type string {
pattern "enabled|disabled|always_enabled";
}
}
}