[yang] Add collector_vrf to sflow yang model (#12897)
- Why I did it Fixed sflow yang model to include collector_vrf field. - How I did it Added leaf for collector_vrf under sflow_collector. Additionally aligned the configuration guide - How to verify it Added UT to verify.
This commit is contained in:
parent
2e760823c1
commit
ce8ffb6812
@ -47,8 +47,9 @@ Table of Contents
|
|||||||
* [Scheduler](#scheduler)
|
* [Scheduler](#scheduler)
|
||||||
* [Port QoS Map](#port-qos-map)
|
* [Port QoS Map](#port-qos-map)
|
||||||
* [Queue](#queue)
|
* [Queue](#queue)
|
||||||
|
* [Syslog Rate Limit](#syslog-rate-limit)
|
||||||
|
* [Sflow](#sflow)
|
||||||
* [Restapi](#restapi)
|
* [Restapi](#restapi)
|
||||||
* [SYSLOG Rate Limit](#syslog-rate-limit)
|
|
||||||
* [Tacplus Server](#tacplus-server)
|
* [Tacplus Server](#tacplus-server)
|
||||||
* [TC to Priority group map](#tc-to-priority-group-map)
|
* [TC to Priority group map](#tc-to-priority-group-map)
|
||||||
* [TC to Queue map](#tc-to-queue-map)
|
* [TC to Queue map](#tc-to-queue-map)
|
||||||
@ -1455,6 +1456,36 @@ name as object key and member list as attribute.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### Sflow
|
||||||
|
|
||||||
|
The below are the tables and their schema for SFLOW feature
|
||||||
|
|
||||||
|
SFLOW
|
||||||
|
|
||||||
|
| Field | Description | Mandatory | Default | Reference |
|
||||||
|
|------------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------------------------------------|
|
||||||
|
| admin_state | Global sflow admin state | | down | |
|
||||||
|
| polling_interval | The interval within which sFlow data is collected and sent to the configured collectors | | 20 | |
|
||||||
|
| agent_id | Interface name | | | PORT:name,PORTCHANNEL:name,MGMT_PORT:name, VLAN:name |
|
||||||
|
|
||||||
|
SFLOW_SESSION
|
||||||
|
|
||||||
|
key - port
|
||||||
|
| Field | Description | Mandatory | Default | Reference |
|
||||||
|
|-------------|-------------------------------------------------------------------------------------------------------------------------|-------------|-----------|-------------|
|
||||||
|
| port | Sets sflow session table attributes for either all interfaces or a specific Ethernet interface. | | | PORT:name |
|
||||||
|
| admin_state | Per port sflow admin state | | up | |
|
||||||
|
| sample_rate | Sets the packet sampling rate. The rate is expressed as an integer N, where the intended sampling rate is 1/N packets. | | | |
|
||||||
|
|
||||||
|
SFLOW_COLLECTOR
|
||||||
|
|
||||||
|
key - name
|
||||||
|
| Field | Description | Mandatory | Default | Reference |
|
||||||
|
|----------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------|
|
||||||
|
| name | Name of the Sflow collector | | | |
|
||||||
|
| collector_ip | IPv4/IPv6 address of the Sflow collector | true | | |
|
||||||
|
| collector_port | Destination L4 port of the Sflow collector | | 6343 | |
|
||||||
|
| collector_vrf | Specify the Collector VRF. In this revision, it is either default VRF or Management VRF.| | | |
|
||||||
|
|
||||||
### Syslog Rate Limit
|
### Syslog Rate Limit
|
||||||
|
|
||||||
|
@ -1273,7 +1273,8 @@
|
|||||||
"collector_port": "6343"
|
"collector_port": "6343"
|
||||||
},
|
},
|
||||||
"collector2": {
|
"collector2": {
|
||||||
"collector_ip": "10.144.1.2"
|
"collector_ip": "10.144.1.2",
|
||||||
|
"collector_vrf": "mgmt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -14,6 +14,21 @@
|
|||||||
"desc": "Configure collectors above the specified limit in SFLOW_COLLECTOR table.",
|
"desc": "Configure collectors above the specified limit in SFLOW_COLLECTOR table.",
|
||||||
"eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"]
|
"eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"]
|
||||||
},
|
},
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_DEFAULT_VRF": {
|
||||||
|
"desc": "Configure a collector in SFLOW_COLLECTOR table with default VRF."
|
||||||
|
},
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_MGMT_VRF": {
|
||||||
|
"desc": "Configure a collector in SFLOW_COLLECTOR table with mgmt VRF."
|
||||||
|
},
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_NON_EXISTING_MGMT_VRF": {
|
||||||
|
"desc": "Configure a collector in SFLOW_COLLECTOR table with mgmt VRF when MGMT VRF is not configured",
|
||||||
|
"eStrKey": "Must"
|
||||||
|
},
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_INVALID_VRF": {
|
||||||
|
"desc": "Configure a collector in SFLOW_COLLECTOR table with invalid vrf",
|
||||||
|
"eStrKey": "Pattern",
|
||||||
|
"eStr": ["mgmt|default"]
|
||||||
|
},
|
||||||
"SFLOW_SESSION_TEST": {
|
"SFLOW_SESSION_TEST": {
|
||||||
"desc": "Configure a sflow session in SFLOW_SESSION table."
|
"desc": "Configure a sflow session in SFLOW_SESSION table."
|
||||||
},
|
},
|
||||||
|
@ -59,6 +59,69 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_DEFAULT_VRF": {
|
||||||
|
"sonic-sflow:sonic-sflow": {
|
||||||
|
"sonic-sflow:SFLOW_COLLECTOR": {
|
||||||
|
"SFLOW_COLLECTOR_LIST": [
|
||||||
|
{
|
||||||
|
"name": "collector1",
|
||||||
|
"collector_ip": "2001:1:2::23",
|
||||||
|
"collector_vrf": "default"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_MGMT_VRF": {
|
||||||
|
"sonic-sflow:sonic-sflow": {
|
||||||
|
"sonic-sflow:SFLOW_COLLECTOR": {
|
||||||
|
"SFLOW_COLLECTOR_LIST": [
|
||||||
|
{
|
||||||
|
"name": "collector1",
|
||||||
|
"collector_ip": "10.100.12.13",
|
||||||
|
"collector_vrf": "mgmt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-mgmt_vrf:sonic-mgmt_vrf": {
|
||||||
|
"sonic-mgmt_vrf:MGMT_VRF_CONFIG": {
|
||||||
|
"sonic-mgmt_vrf:vrf_global": {
|
||||||
|
"mgmtVrfEnabled": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_NON_EXISTING_MGMT_VRF": {
|
||||||
|
"sonic-sflow:sonic-sflow": {
|
||||||
|
"sonic-sflow:SFLOW_COLLECTOR": {
|
||||||
|
"SFLOW_COLLECTOR_LIST": [
|
||||||
|
{
|
||||||
|
"name": "collector1",
|
||||||
|
"collector_ip": "10.100.12.13",
|
||||||
|
"collector_vrf": "mgmt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"SFLOW_TEST_WITH_COLLECTOR_INVALID_VRF": {
|
||||||
|
"sonic-sflow:sonic-sflow": {
|
||||||
|
"sonic-sflow:SFLOW_COLLECTOR": {
|
||||||
|
"SFLOW_COLLECTOR_LIST": [
|
||||||
|
{
|
||||||
|
"name": "collector1",
|
||||||
|
"collector_ip": "10.100.12.13",
|
||||||
|
"collector_vrf": "Vrf1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"SFLOW_SESSION_TEST": {
|
"SFLOW_SESSION_TEST": {
|
||||||
"sonic-port:sonic-port": {
|
"sonic-port:sonic-port": {
|
||||||
"sonic-port:PORT": {
|
"sonic-port:PORT": {
|
||||||
|
@ -25,6 +25,10 @@ module sonic-sflow{
|
|||||||
import sonic-mgmt_port {
|
import sonic-mgmt_port {
|
||||||
prefix mgmt-port;
|
prefix mgmt-port;
|
||||||
}
|
}
|
||||||
|
import sonic-mgmt_vrf {
|
||||||
|
prefix mvrf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
description "SFLOW yang Module for SONiC OS";
|
description "SFLOW yang Module for SONiC OS";
|
||||||
|
|
||||||
@ -43,17 +47,34 @@ module sonic-sflow{
|
|||||||
type string {
|
type string {
|
||||||
length 1..64;
|
length 1..64;
|
||||||
}
|
}
|
||||||
|
description "Name of the Sflow collector";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf collector_ip {
|
leaf collector_ip {
|
||||||
mandatory true;
|
mandatory true;
|
||||||
type inet:ip-address;
|
type inet:ip-address;
|
||||||
|
description "IPv4/IPv6 address of the Sflow collector";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
leaf collector_port {
|
leaf collector_port {
|
||||||
type inet:port-number;
|
type inet:port-number;
|
||||||
default 6343;
|
default 6343;
|
||||||
|
description "Destination L4 port of the Sflow collector";
|
||||||
|
}
|
||||||
|
|
||||||
|
leaf collector_vrf {
|
||||||
|
must "(current() != 'mgmt') or (/mvrf:sonic-mgmt_vrf/mvrf:MGMT_VRF_CONFIG/mvrf:vrf_global/mvrf:mgmtVrfEnabled = 'true')" {
|
||||||
|
error-message "Must condition not satisfied. Try enable Management VRF.";
|
||||||
|
}
|
||||||
|
|
||||||
|
type string {
|
||||||
|
pattern "mgmt|default";
|
||||||
|
}
|
||||||
|
|
||||||
|
description
|
||||||
|
"Specify the Collector VRF. In this revision, it is either
|
||||||
|
default VRF or Management VRF.";
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* end of list SFLOW_COLLECTOR_LIST */
|
} /* end of list SFLOW_COLLECTOR_LIST */
|
||||||
@ -78,6 +99,7 @@ module sonic-sflow{
|
|||||||
leaf admin_state {
|
leaf admin_state {
|
||||||
type stypes:admin_status;
|
type stypes:admin_status;
|
||||||
default up;
|
default up;
|
||||||
|
description "Per port sflow admin state";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf sample_rate {
|
leaf sample_rate {
|
||||||
@ -99,6 +121,7 @@ module sonic-sflow{
|
|||||||
leaf admin_state {
|
leaf admin_state {
|
||||||
type stypes:admin_status;
|
type stypes:admin_status;
|
||||||
default down;
|
default down;
|
||||||
|
description "Global sflow admin state";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf polling_interval {
|
leaf polling_interval {
|
||||||
|
Reference in New Issue
Block a user