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

Yang model support for SRV6 CRM #9487

Merged
merged 1 commit into from
Aug 1, 2022
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
38 changes: 38 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/crm.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,43 @@
},
"MPLS_NH_WITH_CORRECT_USED_VALUE": {
"desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure."
},
"SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[](http://example.com/codeflow?start=0&length=4)

This file is mixing tabs and spaces. Could you reformat the whole file?

"desc": "SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStrKey": "Pattern",
"eStr": ["wrong" ]
},
"SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE": {
"desc": "SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE must condition failure.",
"eStrKey": "Must"
},
"SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR": {
"desc": "SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": ["high_threshold should be more than low_threshold"]
},
"SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE": {
"desc": "SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE no failure."
},
"SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE": {
"desc": "SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE no failure."
},
"SRV6_NH_WITH_WRONG_THRESHOLD_TYPE": {
"desc": "SRV6_NH_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStrKey": "Pattern",
"eStr": ["wrong" ]
},
"SRV6_NH_WITH_WRONG_PERCENTAGE": {
"desc": "SRV6_NH_WITH_WRONG_PERCENTAGE must condition failure.",
"eStrKey": "Must"
},
"SRV6_NH_WITH_HIGH_THRESHOLD_ERR": {
"desc": "SRV6_NH_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": ["high_threshold should be more than low_threshold"]
},
"SRV6_NH_WITH_CORRECT_USED_VALUE": {
"desc": "SRV6_NH_WITH_CORRECT_USED_VALUE no failure."
},
"SRV6_NH_WITH_CORRECT_USED_VALUE": {
"desc": "SRV6_NH_WITH_CORRECT_USED_VALUE no failure."
}
}
110 changes: 110 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,5 +328,115 @@
}
}
}
},
"SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_my_sid_entry_high_threshold": 90,
"srv6_my_sid_entry_low_threshold": 70,
"srv6_my_sid_entry_threshold_type": "free"
}
}
}
},
"SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_my_sid_entry_high_threshold": 85,
"srv6_my_sid_entry_low_threshold": 25,
"srv6_my_sid_entry_threshold_type": "used"
}
}
}
},
"SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_my_sid_entry_high_threshold": 80,
"srv6_my_sid_entry_low_threshold": 81,
"srv6_my_sid_entry_threshold_type": "PERCENTAGE"
}
}
}
},
"SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_my_sid_entry_high_threshold": 110,
"srv6_my_sid_entry_low_threshold": 85,
"srv6_my_sid_entry_threshold_type": "PERCENTAGE"
}
}
}
},
"SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_my_sid_entry_high_threshold": 90,
"srv6_my_sid_entry_low_threshold": 70,
"srv6_my_sid_entry_threshold_type": "wrong"
}
}
}
},
"SRV6_NH_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_nexthop_high_threshold": 90,
"srv6_nexthop_low_threshold": 70,
"srv6_nexthop_threshold_type": "free"
}
}
}
},
"SRV6_NH_WITH_CORRECT_USED_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_nexthop_high_threshold": 85,
"srv6_nexthop_low_threshold": 25,
"srv6_nexthop_threshold_type": "used"
}
}
}
},
"SRV6_NH_WITH_HIGH_THRESHOLD_ERR": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_nexthop_high_threshold": 80,
"srv6_nexthop_low_threshold": 81,
"srv6_nexthop_threshold_type": "PERCENTAGE"
}
}
}
},
"SRV6_NH_WITH_WRONG_PERCENTAGE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_nexthop_high_threshold": 110,
"srv6_nexthop_low_threshold": 85,
"srv6_nexthop_threshold_type": "PERCENTAGE"
}
}
}
},
"SRV6_NH_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"srv6_nexthop_high_threshold": 90,
"srv6_nexthop_low_threshold": 70,
"srv6_nexthop_threshold_type": "wrong"
}
}
}
}
}
52 changes: 52 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-crm.yang
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,58 @@ module sonic-crm {
type threshold;
}

leaf srv6_my_sid_entry_threshold_type {
description "CRM threshold support for SRV6 my_sid entries";

must "(((current()='PERCENTAGE' or current()='percentage') and
../srv6_my_sid_entry_high_threshold<100 and
Copy link
Collaborator

Choose a reason for hiding this comment

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

<

<= ?

../srv6_my_sid_entry_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='percentage'))";
type stypes:crm_threshold_type;
}

leaf srv6_my_sid_entry_high_threshold {
description "CRM threshold support for SRV6 my_sid entries";

must "(current() > ../srv6_my_sid_entry_low_threshold)"
{
error-message "high_threshold should be more than low_threshold";
}
type threshold;
}

leaf srv6_my_sid_entry_low_threshold {
description "CRM threshold support for SRV6 my_sid entries";

type threshold;
}

leaf srv6_nexthop_threshold_type {
description "CRM threshold support for SRV6 next-hops";

must "(((current()='PERCENTAGE' or current()='percentage') and
../srv6_nexthop_high_threshold<100 and
../srv6_nexthop_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='percentage'))";
type stypes:crm_threshold_type;
}

leaf srv6_nexthop_high_threshold {
description "CRM threshold support for SRV6 next-hops";

must "(current() > ../srv6_nexthop_low_threshold)"
{
error-message "high_threshold should be more than low_threshold";
}
type threshold;
}

leaf srv6_nexthop_low_threshold {
description "CRM threshold support for SRV6 next-hops";

type threshold;
}

}
/* end of Config */
}
Expand Down