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

Add hashing model #939

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6dc4d60
Add ETH_400GBASE_PSM4 PMD type to openconfig-transport-types
atmanmehta Sep 21, 2022
b91ca2b
Add ETH_400GMSA_PSM4 PMD type to openconfig-transport-types
atmanmehta Sep 21, 2022
103fd41
Merge branch 'master' into master
atmanmehta Oct 19, 2022
ac7e1fd
Update openconfig version
atmanmehta Oct 19, 2022
fa31346
Merge branch 'master' of github.com:atmanmehta/public
atmanmehta Oct 19, 2022
7345700
Add hashing model to OC. There will be leaf-refs added to interfaces …
atmanmehta Aug 11, 2023
67e6313
Merge branch 'master' into master
atmanmehta Aug 11, 2023
02e8937
Update openconfig-transport-types.yang
atmanmehta Aug 11, 2023
6aa5e44
Update openconfig-hashing.yang
atmanmehta Aug 11, 2023
0d3abf6
Update openconfig-hashing.yang
atmanmehta Aug 11, 2023
fc1a625
Update openconfig-hashing.yang
atmanmehta Aug 11, 2023
54ef11a
Trigger Build
wenovus Mar 23, 2023
107157e
Trigger Build
wenovus Mar 23, 2023
3d718b7
Trigger Build
wenovus Jul 14, 2023
db80ecb
Trigger Build
wenovus Jul 14, 2023
917fb48
Trigger Build
wenovus Jul 14, 2023
9f14325
Trigger Build
wenovus Jul 14, 2023
31f6db5
Trigger Build
wenovus Jul 14, 2023
ba3ac73
Trigger Build
wenovus Aug 1, 2023
bd95c55
Add ETH_400GBASE_PSM4 PMD type to openconfig-transport-types
atmanmehta Sep 21, 2022
5eca652
Rebase to master
atmanmehta Sep 21, 2022
67cef07
Address hashing model comments
atmanmehta Aug 28, 2023
0865108
Merge branch 'openconfig:master' into master
atmanmehta Aug 28, 2023
454ef21
Remove pyang files
atmanmehta Aug 28, 2023
5c2fbda
Update version for interfaces and system models
atmanmehta Aug 28, 2023
8e3df69
Remove unnecessary list.
atmanmehta Aug 28, 2023
cd5e0e4
Add namespace to leafref path
atmanmehta Aug 28, 2023
1dc0d28
Add description for hashing-policy leaf
atmanmehta Aug 28, 2023
ed9d2a8
Add typedefs for enums
atmanmehta Aug 29, 2023
827694d
Fix linter errors
atmanmehta Aug 29, 2023
7dfb276
Move the hash-field-modes container from the hashing-inputs grouping …
atmanmehta Aug 29, 2023
75591df
Move hashing-inputs into it's own config/state container to make Open…
atmanmehta Aug 29, 2023
f3f0110
Move hash-field-modes ito the policy tree
atmanmehta Aug 29, 2023
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
6 changes: 6 additions & 0 deletions release/models/hashing/.spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: openconfig-hashing
docs:
- yang/hashing/openconfig-hashing.yang
build:
- yang/hashing/openconfig-hashing.yang
run-ci: true
238 changes: 238 additions & 0 deletions release/models/hashing/openconfig-hashing.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
module openconfig-hashing {
yang-version "1";

// namespace
namespace "http://openconfig.net/yang/hashing";

prefix "oc-hashing";

// import some basic types
import openconfig-extensions { prefix oc-ext; }

// meta
organization "OpenConfig working group";

contact
"OpenConfig working group
netopenconfig@googlegroups.com";

description
"Model for managing hashing policies that would be referenced by the
interfaces model.";


oc-ext:openconfig-version "0.1.0";

revision "2023-08-08" {
description "Initial hashing model.";
reference "0.1.0";
}

// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
dplore marked this conversation as resolved.
Show resolved Hide resolved
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";

typedef hash-field-type-ipv4 {
dplore marked this conversation as resolved.
Show resolved Hide resolved
type enumeration {
enum NONE {
description "Do not use any IPv4 fields in the
calculation of the hash.";
}
enum SRC_ADDRESS {
description "Use only the IPv4 source address in the
calculation of the hash.";
}
enum DST_ADDRESS {
description "Use only the IPv4 destination address in the
calculation of the hash.";
}
enum BOTH {
description "Use both the IPv4 source and
destination addresses in the calculation of the
hash.";
}
enum TARGET_DEFINED {
Copy link
Contributor

Choose a reason for hiding this comment

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

How does one test this configuration parameter?

Copy link
Member

Choose a reason for hiding this comment

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

A test would require target specific knowledge to create a test for this particular enum. Use of this enum is expected when the target contains some default or hardcoded selection of fields which are not described by the model.

For example, an asic may select only a portion of the bits in the src and dest ip address fields and port number fields. Which bits are used may not be exposed and may not be configurable by the user, by the NOS or by the ASIC SDK. Yet they are still "target defined" and don't match the other enums presented here.

If a target defined mode isn't available on an implementation, then the implementation should return an UNIMPLEMENTED (12) error.

Copy link
Member

Choose a reason for hiding this comment

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

We can update the description for this enum in #959

Copy link
Member

Choose a reason for hiding this comment

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

Continue the discussion here as desired: https://github.com/openconfig/public/pull/959/files#r1337998777

description "Use the default fields that are used by
the device for calculating the hash.";
}
dplore marked this conversation as resolved.
Show resolved Hide resolved
}
description "The IPv4 fields that should be used to
compute the hash.";
}

typedef hash-field-type-ipv6 {
dplore marked this conversation as resolved.
Show resolved Hide resolved
type enumeration {
enum NONE {
description "Do not use any IPv6 fields in the
calculation of the hash.";
}
enum SRC_ADDRESS {
description "Use only the IPv6 source address in the
calculation of the hash.";
}
enum DST_ADDRESS {
description "Use only the IPv6 destination address in the
calculation of the hash.";
}
enum BOTH {
description "Use both the IPv6 source and
destination addresses in the calculation of the
hash.";
}
enum TARGET_DEFINED {
description "Use the default fields that are used by
the device for calculating the hash.";
}
enum FLOW_LABEL {
description "Use the flow label in the IPv6 header
to calculate the hash.";
}
dplore marked this conversation as resolved.
Show resolved Hide resolved
}
description "The IPv6 fields that should be used to
compute the hash.";
}

typedef hash-field-type-transport {
type enumeration {
enum NONE {
description "Do not use any transport fields in the
calculation of the hash.";
}
enum SRC_PORT {
description "Use only the source port from the
transport header in the calculation of the hash.";
}
enum DST_PORT {
description "Use only the destination port from the
transport header in the calculation of the hash.";
}
enum BOTH {
description "Use both the source and
destination ports from the transport header in
the calculation of the hash.";
}
enum TARGET_DEFINED {
description "Use the default fields that are used by
the device for calculating the hash.";
}
}
description "The trasport layer fields that should be used to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description "The trasport layer fields that should be used to
description "The transport layer fields that should be used to

compute the hash.";
}

grouping hashing-inputs {
description
"Top level container for inputs to be used for hashing policies.";

leaf ipv4 {
dplore marked this conversation as resolved.
Show resolved Hide resolved
type hash-field-type-ipv4;
description "The IPv4 fields that should be used to
compute the hash.";
}
leaf ipv6 {
dplore marked this conversation as resolved.
Show resolved Hide resolved
type hash-field-type-ipv6;
description "The IPv6 fields that should be used to
compute the hash.";
}
leaf transport-ports {
type hash-field-type-transport;
description "The transport layer fields that should be used to
compute the hash.";
}
Copy link
Contributor

@rszarecki rszarecki Sep 7, 2023

Choose a reason for hiding this comment

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

I would like to see additionaly:
IPv4_in_IPv4 and IPv6-in-IPv4 where each lement is again list of outher and inner fields:
ipv4_ipv4/outherfields/outherfield type hash-field-type-ipv4
ipv4_ipv4/innerfields/innerfield type hash-field-type-ipv4
ipv6_ipv4/outherfields/outherfield/ipv4 hash-field-type-ipv6
ipv6_ipv4/innerfields/innerfield/ipv6 hash-field-type-ipv6


Similiarly fot ip-over-GRE over IPv4/IPv6,
grev4/outherfields/outherfield type hash-field-type-ipv4
grev4/payloads/payload enum(ipv4 ipv6 mpls Eth) // use fields deviend for basic v4,v6,mpls,eth depending on GRE protocol. if not on list
grev6/outherfields/outherfield type hash-field-type-ipv6
grev6/payloads/payload enum(ipv4 ipv6 mpls Eth) // use fields deviend for basic v4,v6,mpls,eth depending on GRE protocol. if not on list


Also for MPLS
mpls/labels - number of labels to use
mpls/base enum bottom XOR top default top
mpls/payloads/payload enum (ipv4 ipv6 PWE3 ipv4_grev4 ipv6_grev6 ipv4_ipv4 ipv6_ipv4 ...)


Also Eth- usefull for PWE3 services or L2 switching devices
eth/fields/fild enum (srcMAC,dstMAC,Vlan-ID, EtherType/payload, ingress_subinterface)
eth/payloads/payload enum ((ipv4 ipv6 PWE3 ipv4_grev4 ipv6_grev6 ipv4_ipv4 ipv6_ipv4 ...)

Copy link
Member

Choose a reason for hiding this comment

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

For this PR we will only introduce the simple field selection which is targeted for gPINS release and is at least partially supported by the referenced implementations in this PR.

It is possible to add additional encapsulations in the future without breaking changes to the model by adding additional leafs to this hashing-inputs grouping. The additional leafs may be added to the public OC model in the future, or they can be vendor augments.

Since there are many constraints in hardware as to which encapsulations may be supported, especially for more complex use cases, we should leave open the option that vendors are expected to augment the model with the specific scenarios they support. These are often custom or one-off items that are not generally available and may also not be formally documented, which is a good reason to use a vendor provided augment. These 'custom' options may also not be very 'configurable'. For example, hardware may support only using a subset of the bits of some fields (ipv6 comes to mind). Which bits are used may not be configurable or even exposed to the user through the model, config or even the SDK. Using a vendor augment, a vendor can expose the ability to turn on or off these capabilities.

}

grouping hashing-policy-config {
description
"Configuration data for hashing policies.";

leaf name {
type string;
description
"The name of the hashing policy.

When a configured user-controlled policy is created by the
system, it is instantiated with the same name in the
/policies/policy[name]/state list.";
}

leaf algorithm {
type string;
dplore marked this conversation as resolved.
Show resolved Hide resolved
description
"The algorithm used when calculating a hash based on packet headers";
}
dplore marked this conversation as resolved.
Show resolved Hide resolved

leaf offset {
dplore marked this conversation as resolved.
Show resolved Hide resolved
dplore marked this conversation as resolved.
Show resolved Hide resolved
type uint64;
description
"The number of bits to rotate the output of the hash algorithm by
in order to get the final computed hash value";
}

leaf seed {
type uint64;
description
"The seed used to initialize the hash algorithm";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would ass 2 boolena leafs:
symmetric - ensured that traffic of bi-dir session produce same hash. (e.g. src/dst fields are ordered before feeding hash function)
persistent - ensures that if fwd-nh (e.g. LAG member) fails, flows that was on other members are not re-hashed. only affected flows are re-distributed among remaining fwd-nh.

Copy link
Member

Choose a reason for hiding this comment

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

References to implementation needed for this?


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
leaf symmetric {
type boolean;
default false;
description
"Hash is sematrical - returns same value regardless of traffic direction of same flow/session. Also regardless of ingress interface";
}
leaf persistent {
type boolean;
default false;
description
"In case of output inteface/forwarding-nh failure/removal, only flows that have used this interface/nexthop are re-hashed";
}

Copy link
Member

Choose a reason for hiding this comment

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

References to implementation needed for this?

}

grouping hashing-top {
description
"Top level grouping for hashing configuration and operational state
data.";

container policies {
dplore marked this conversation as resolved.
Show resolved Hide resolved
description
"Top level container for hashing, including configuration and
state data.";

list policy {
key "name";

description
"The list of named policies to be used on the device.";

leaf name {
type leafref {
path "../config/name";
}
description
"References the name of the hashing policy.";
}
container config {
description
"Configurable items at the global hash policy level.";

uses hashing-policy-config;
}
container state {
config false;
description
"Operational state data at the global hash policy
level.";

uses hashing-policy-config;
}
container hash-field-modes {
description
"Container for specifying inputs to be used when
calculating the hash.";
container config {
description
"Configurable items at the hashing inputs level.";
uses hashing-inputs;
}
container state {
config false;
description "Operational state data at the hashing
inputs level.";
uses hashing-inputs;
}
}
}
}
}

uses hashing-top;
}
16 changes: 15 additions & 1 deletion release/models/interfaces/openconfig-interfaces.yang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module openconfig-interfaces {
import openconfig-types { prefix oc-types; }
import openconfig-extensions { prefix oc-ext; }
import openconfig-transport-types { prefix oc-opt-types; }
import openconfig-hashing { prefix oc-hashing; }

// meta
organization "OpenConfig working group";
Expand Down Expand Up @@ -51,7 +52,12 @@ module openconfig-interfaces {
Section 4.c of the IETF Trust's Legal Provisions Relating
to IETF Documents (http://trustee.ietf.org/license-info).";

oc-ext:openconfig-version "3.5.0";
oc-ext:openconfig-version "3.6.0";

revision "2023-08-28" {
description "Add leaf for referencing a hashing policy.";
reference "3.6.0";
}

revision "2023-07-14" {
description
Expand Down Expand Up @@ -432,6 +438,14 @@ module openconfig-interfaces {
the specified mode.";
}

leaf hashing-policy {
type leafref {
path "/oc-hashing:policies/oc-hashing:policy/oc-hashing:name";
}
description "The hashing policy to be used when hashing packets coming
in on the interface.";
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I only see that Arista allows for some hash configuration on per ingress interfaces basis. And it is not clear form referenced documentation on which platform/chipset.

Copy link
Member

Choose a reason for hiding this comment

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

The intent here is that this is a list of policies. We'll update the description to not reference 'packets coming in the interface'. gPINS will add support for multiple policies and Arista EOS is an existing implementation

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you link to the documentation that shows this being configurable per ingress /interface/ please? It's not clear to me that this is widely supported.

Copy link
Member

Choose a reason for hiding this comment

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

Per interface is not widely supported. gPINS plans to add support for this to Sonic. Should we include this leaf in the model or only augment /interfaces in a gPINS/SONIC yang? Please follow up with comments at #959

uses interface-common-config;
}

Expand Down
17 changes: 15 additions & 2 deletions release/models/system/openconfig-system.yang
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module openconfig-system {
import openconfig-messages { prefix oc-messages; }
import openconfig-license { prefix oc-license; }
import openconfig-network-instance { prefix oc-ni; }
import openconfig-hashing { prefix oc-hashing; }

// meta
organization "OpenConfig working group";
Expand All @@ -47,7 +48,12 @@ module openconfig-system {
Section 4.c of the IETF Trust's Legal Provisions Relating
to IETF Documents (http://trustee.ietf.org/license-info).";

oc-ext:openconfig-version "0.17.1";
oc-ext:openconfig-version "0.17.2";

revision "2023-08-28" {
description "Add leaf for referencing a hashing policy.";
reference "0.17.2";
dplore marked this conversation as resolved.
Show resolved Hide resolved
}

revision "2023-06-16" {
description
Expand Down Expand Up @@ -310,6 +316,13 @@ module openconfig-system {
information such as the current system date and time, uptime,
last login timestamp, etc.";
}

leaf hashing-policy {
type leafref {
path "/oc-hashing:policies/oc-hashing:policy/oc-hashing:name";
}
description "The system default hashing policy to be used when hashing packets.";
}
}

grouping mount-point-state {
Expand Down Expand Up @@ -1280,4 +1293,4 @@ module openconfig-system {

// data definition statements
uses system-top;
}
}
Loading