[YANG] Add route flow counter support (#9814)

* [YANG] Add route flow counter support
This commit is contained in:
Junchao-Mellanox 2022-03-25 06:14:30 +08:00 committed by GitHub
parent e2502edefd
commit 9282618450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 164 additions and 0 deletions

View File

@ -1021,6 +1021,21 @@
}, },
"DEBUG_COUNTER": { "DEBUG_COUNTER": {
"FLEX_COUNTER_STATUS": "enable" "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": { "CRM": {

View File

@ -6,5 +6,16 @@
"desc": "Out of range poll interval.", "desc": "Out of range poll interval.",
"eStrKey": "Range", "eStrKey": "Range",
"eStr": "100..4294967295" "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"
} }
} }

View File

@ -46,6 +46,10 @@
"FLOW_CNT_TRAP": { "FLOW_CNT_TRAP": {
"FLEX_COUNTER_STATUS": "enable", "FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 10000 "POLL_INTERVAL": 10000
},
"FLOW_CNT_ROUTE": {
"FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 10000
} }
} }
} }
@ -97,8 +101,77 @@
"FLOW_CNT_TRAP": { "FLOW_CNT_TRAP": {
"FLEX_COUNTER_STATUS": "enable", "FLEX_COUNTER_STATUS": "enable",
"POLL_INTERVAL": 99 "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
}
]
}
}
},
"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",
"max_match_count": 0
}
]
}
}
} }
} }

View File

@ -5,6 +5,10 @@ module sonic-flex_counter {
namespace "http://github.com/Azure/sonic-flex_counter"; namespace "http://github.com/Azure/sonic-flex_counter";
prefix flex_counter; prefix flex_counter;
import ietf-inet-types {
prefix inet;
}
import sonic-types { import sonic-types {
prefix stypes; prefix stypes;
} }
@ -211,8 +215,69 @@ module sonic-flex_counter {
} }
} }
container FLOW_CNT_ROUTE {
/* 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 */ /* 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 {
/*
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 */ /* end of top level container */
} }