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] Add route flow counter support #9814

Merged
merged 5 commits into from
Mar 24, 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
15 changes: 15 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 @@ -957,6 +957,21 @@
},
"DEBUG_COUNTER": {
"FLEX_COUNTER_STATUS": "enable"
},
"FLOW_CNT_ROUTE": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": "10000"
}
},
"FLOW_COUNTER_ROUTE_PATTERN": {
"1.1.1.0/24": {
"max_match_count": "30"
},
"2000::/64": {
"max_match_count": "30"
},
"Vnet1|2.2.2.0/24": {
"max_match_count": "30"
}
},
"CRM": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,16 @@
"desc": "Out of range poll interval.",
"eStrKey": "Range",
"eStr": "100..4294967295"
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF": {
"desc": "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF no failure."
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF": {
"desc": "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF no failure."
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_INVALID_MAX_MATCH_COUNT": {
"desc": "Out of range max_match_count.",
"eStrKey": "Range",
"eStr": "1..50"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"FLOW_CNT_TRAP": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 10000
},
"FLOW_CNT_ROUTE": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 10000
}
}
}
Expand Down Expand Up @@ -97,8 +101,77 @@
"FLOW_CNT_TRAP": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 99
},
"FLOW_CNT_ROUTE": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 99
}
}
}
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF": {
"sonic-vrf:sonic-vrf":{
"sonic-vrf:VRF": {
"VRF_LIST": [
{
"name":"Vrf1"
}
]
}
},
"sonic-flex_counter:sonic-flex_counter": {
"sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": {
"FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST": [
{
"vrf_name": "Vrf1",
"ip_prefix": "1.1.1.0/24",
"max_match_count": 30
},
{
"vrf_name": "Vrf1",
"ip_prefix": "2000::/64",
"max_match_count": 30
Junchao-Mellanox marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
}
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF": {
"sonic-flex_counter:sonic-flex_counter": {
"sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": {
"FLOW_COUNTER_ROUTE_PATTERN_LIST": [
{
"ip_prefix": "1.1.1.0/24",
"max_match_count": 30
},
{
"ip_prefix": "2000::/64",
"max_match_count": 30
}
]
}
}
},
"FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_INVALID_MAX_MATCH_COUNT": {
"sonic-vrf:sonic-vrf":{
"sonic-vrf:VRF": {
"VRF_LIST": [
{
"name":"Vrf1"
}
]
}
},
"sonic-flex_counter:sonic-flex_counter": {
"sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": {
"FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST": [
{
"vrf_name": "Vrf1",
"ip_prefix": "1.1.1.0/24",
Junchao-Mellanox marked this conversation as resolved.
Show resolved Hide resolved
"max_match_count": 0
}
]
}
}
}
}
65 changes: 65 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-flex_counter.yang
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module sonic-flex_counter {
namespace "http://github.com/Azure/sonic-flex_counter";
prefix flex_counter;

import ietf-inet-types {
prefix inet;
}

import sonic-types {
prefix stypes;
}
Expand Down Expand Up @@ -211,8 +215,69 @@ module sonic-flex_counter {
}
}

container FLOW_CNT_ROUTE {
Junchao-Mellanox marked this conversation as resolved.
Show resolved Hide resolved
/* ROUTE_FLEX_COUNTER_GROUP */
leaf FLEX_COUNTER_STATUS {
type flex_status;
}
leaf FLEX_COUNTER_DELAY_STATUS {
type flex_delay_status;
}
leaf POLL_INTERVAL {
type poll_interval;
}
}

}
/* end of container FLEX_COUNTER_TABLE */

container FLOW_COUNTER_ROUTE_PATTERN {
description "Flow counter route pattern of config_db.json";

list FLOW_COUNTER_ROUTE_PATTERN_LIST {

key "ip_prefix";

leaf ip_prefix {
type inet:ip-prefix;
}

leaf max_match_count {
type uint32 {
range 1..50;
}
}

}

list FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST {

key "vrf_name ip_prefix";

leaf vrf_name {
Junchao-Mellanox marked this conversation as resolved.
Show resolved Hide resolved
/*
We don't use vrf_name reference here because:
1. User is allowed to configure a VRF that does not exist yet here, orchagent is designed to resolve the VRF name once the VRF is created.
2. The field vrf_name accept both VRF name and VNET name.
*/
type string {
length 0..16;
}
}

leaf ip_prefix {
type inet:ip-prefix;
}

leaf max_match_count {
type uint32 {
range 1..50;
}
}

}
}
/* end of container FLOW_COUNTER_ROUTE_PATTERN */
}
/* end of top level container */
}
Expand Down