Skip to content
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
2 changes: 1 addition & 1 deletion rules/sflow.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# host-sflow package

HSFLOWD_VERSION = 2.0.35
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason for not using latest version 2.0.51 ? or stable previous versions such as 2.0.49?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No specific reason. Egress sample support was added in 2.0.45. Hence updated to this version.

HSFLOWD_VERSION = 2.0.45
HSFLOWD_SUBVERSION = 1

export ENABLE_SFLOW_DROPMON
Expand Down
5 changes: 3 additions & 2 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,8 @@ SFLOW

| Field | Description | Mandatory | Default | Reference |
|------------------|-----------------------------------------------------------------------------------------|-------------|-----------|-------------------------------------------|
| admin_state | Global sflow admin state | | down | |
| admin_state | Global sflow admin state | | down |
| sample_direction | Global sflow sample direction | | rx | |
| 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 |

Expand All @@ -1661,7 +1662,7 @@ key - port
| 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. | | | |

| sample_direction| Per port sflow sample direction | | rx
SFLOW_COLLECTOR

key - name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
{
"port": "Ethernet0",
"admin_state": "up",
"sample_direction": "both",
"sample_rate": "40000"
}
]
Expand All @@ -158,6 +159,7 @@
{
"port": "Ethernet4",
"admin_state": "down",
"sample_direction": "tx",
"sample_rate": "32768"
}
]
Expand Down Expand Up @@ -242,6 +244,7 @@
"global": {
"agent_id": "Ethernet0",
"admin_state": "up",
"sample_direction": "both",
"polling_interval": "20"
}
}
Expand Down
32 changes: 32 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-sflow.yang
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,28 @@ module sonic-sflow{

description "SFLOW yang Module for SONiC OS";

revision 2023-04-11 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In https://github.com/openconfig/public/blob/master/release/models/sampling/openconfig-sampling-sflow.yang egress-sampling-rate supported at global level and per interface level ? How do we map sonic-sflow.yang to https://github.com/openconfig/public/blob/master/release/models/sampling/openconfig-sampling-sflow.yang ? or we don't support egress-sampling-rate configuration at all in SONIC?

Copy link
Copy Markdown
Contributor Author

@rajkumar38 rajkumar38 Apr 19, 2023

Choose a reason for hiding this comment

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

As per sflow spec, sampling rate has to be symmetrical on an interface. Pls check the review discussion in HLD. And openconfig model is not aligned to this. Based on the discussion, it was decided to have single sample-rate variable and manage the direction using "sample-direction" which is available at global and interface level. With this model, egress sampling is achieved by setting sample-direction to either "tx" or "both".

description "Add direction command to support egress sflow";
}

revision 2021-04-26 {
description "First Revision";
}

typedef sample_direction {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per https://github.com/openconfig/public/blob/master/release/models/sampling/openconfig-sampling-sflow.yang it assumes that the interface will perform both ingress and egress sampling without the need of direction leaf? If that is the case when we support latest https://github.com/openconfig/public/blob/master/release/models/sampling/openconfig-sampling-sflow.yang in community sonic we should always populate direction as "both" in sonic-flow.yang?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As mentioned in above comment, as per sflow spec, an interface must have same sample-rate on ingress and egress. Since initial support in SONiC was handling only Ingress, default value is set to "rx" for backward compatibility. Pls check HLD for more info.

type enumeration {
enum rx {
description "rx direction";
}
enum tx {
description "tx direction";
}
enum both {
description "Both tx and rx direction";
}
}
}

container sonic-sflow {

container SFLOW_COLLECTOR {
Expand Down Expand Up @@ -111,6 +129,13 @@ module sonic-sflow{
}
description "Sets the packet sampling rate. The rate is expressed as an integer N, where the intended sampling rate is 1/N packets.";
}

leaf sample_direction {
type sample_direction;
default "rx";
description "sflow sample direction";
}

} /* end of list SFLOW_SESSION_LIST */
} /* end of container SFLOW_SESSION */

Expand Down Expand Up @@ -156,6 +181,13 @@ module sonic-sflow{
}
description "Interface name";
}

leaf sample_direction {
type sample_direction;
default "rx";
description "sflow sample direction";
}

} /* end of container global */
} /* end of container SFLOW */

Expand Down