Skip to content

Commit

Permalink
statd: more detailed operational data for lacp aggregates
Browse files Browse the repository at this point in the history
 - YANG model, fold in groupings, add enums
 - Add LACP system priorty, actor/partner key, partner mac, etc.

Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Dec 19, 2024
1 parent c76678a commit 6df328c
Show file tree
Hide file tree
Showing 3 changed files with 278 additions and 126 deletions.
294 changes: 186 additions & 108 deletions src/confd/yang/infix-if-lag.yang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ submodule infix-if-lag {
import ietf-inet-types {
prefix inet;
}
import ietf-yang-types {
prefix yang;
}

organization "KernelKit";
contact "[email protected]";
Expand All @@ -27,116 +30,104 @@ submodule infix-if-lag {
* Typedefs
*/

typedef lag-type {
description "Mode values for link aggregates.";
typedef lag-mode {
description "Mode values for link aggregates.";

/* Temporarily limited to 802.1AX and Balanced XOR */
type enumeration {
enum static {
description "Static mode (Balanced XOR).";
value 2;
}
enum lacp {
description "IEEE 802.3ad LACP mode.";
value 4;
}
type enumeration {
enum static {
description "Static mode (Balanced XOR).";
}
}

typedef lacp-mode {
description "LACP mode values.";

type enumeration {
enum passive {
description "LACP active mode";
value 0;
}
enum active {
description "LACP passive mode.";
value 1;
}
enum lacp {
description "IEEE 802.3ad LACP mode.";
}
}
}

/*
* Shared settings
*/

grouping hash {
leaf hash {
description "Transmit hash policy.";
config false; // For now, staically set to layer2 only
type string;
typedef lag-type {
description "Static mode type of distribution (driver modes).";

type enumeration {
enum balance-rr;
enum active-backup;
enum balance-xor;
enum broadcast;
enum balance-tlb;
enum balance-alb;
}
}

grouping lacp-settings {
description "LACP mode settings.";

container lacp {
description "Settings specific for LACP mode.";
typedef hash-policy {
description "Egress hash policy, note: offloading limitations!";

uses hash;

leaf mode {
description "Operational mode of LACP, default: active.
type enumeration {
enum layer2;
enum layer3-4;
enum layer2-3;
enum encap2-3;
enum encap3-4;
enum vlan-srcmac;
}
}

- Active: initiates negotiation by sending LACPDUs.
- Passive: waits for the peer to initiate.
typedef member-state {
description "Lag port membership state, taking active part or backup.";

At least one end of the link must be in active mode. When both ends
are active, there is slightly more traffic, but the default ensures
fail-safe operation.
type enumeration {
enum backup;
enum active;
}
}

Passive mode is typically used for troubleshooting, in dynamic
setups (e.g., MLAG), or to minimize the risk of unintended
aggregation.
typedef lacp-mode {
description "LACP mode values.";

For most production scenarios, active mode is preferred to ensure
faster and more predictable link aggregation.";
type lacp-mode;
default "active";
type enumeration {
enum passive {
description "LACP active mode";
}
enum active {
description "LACP passive mode.";
}
}
}

leaf rate {
description "Rate of LACP keep-alives, default: slow.
Determines the frequency of LACPDU transmission and the associated
timeout for link failure detection.
- slow: Sends LACPDUs every 30 seconds. The associated timeout is 90
seconds, meaning a link is considered failed after 3 consecutive
missed LACPDUs.
- fast: Sends LACPDUs every 1 second. The associated timeout is 3
seconds, meaning a link is considered failed after 3 consecutive
missed LACPDUs.
typedef lacp-rate {
description "LACP rate values.";

The selected rate affects the responsiveness of link failure
detection and the amount of control traffic.";
type enumeration {
enum slow {
description "Send LACPDUs every 30 seconds (90-second timeout).";
}
enum fast {
description "Send LACPDUs every 1 second (3-second timeout).";
}
}
default "slow";
type enumeration {
enum slow {
description "Send LACPDUs every 30 seconds (90-second timeout).";
}
enum fast {
description "Send LACPDUs every 1 second (3-second timeout).";
}
}
}

grouping static-settings {
container static {
config false; // For now, we need to read out mode and other status
typedef lacp-state {
description "LACP port state flags.";

type enumeration {
enum active;
enum short_timeout;
enum aggregating;
enum in_sync;
enum collecting;
enum distributing;
enum defaulted;
enum expired;
}
}

uses hash;
/*
* Shared settings
*/

leaf mode {
description "Active mode for static aggregates.";
type string;
}
grouping hash {
leaf hash {
description "Transmit hash policy.";
type hash-policy;
config false; // For now, staically set to layer2 only
}
}

Expand All @@ -156,12 +147,100 @@ submodule infix-if-lag {

leaf mode {
description "Link aggregation mode.";
type lag-type;
type lag-mode;
mandatory true;
}

uses lacp-settings;
uses static-settings;
container lacp {
description "Settings specific for LACP mode.";

uses hash;

leaf mode {
description "Operational mode of LACP, default: active.
- Active: initiates negotiation by sending LACPDUs.
- Passive: waits for the peer to initiate.
At least one end of the link must be in active mode. When both ends
are active, there is slightly more traffic, but the default ensures
fail-safe operation.
Passive mode is typically used for troubleshooting, in dynamic
setups (e.g., MLAG), or to minimize the risk of unintended
aggregation.
For most production scenarios, active mode is preferred to ensure
faster and more predictable link aggregation.";
type lacp-mode;
default active;
}

leaf rate {
description "Rate of LACP keep-alives, default: slow.
Determines the frequency of LACPDU transmission and the associated
timeout for link failure detection.
- slow: Sends LACPDUs every 30 seconds. The associated timeout is 90
seconds, meaning a link is considered failed after 3 consecutive
missed LACPDUs.
- fast: Sends LACPDUs every 1 second. The associated timeout is 3
seconds, meaning a link is considered failed after 3 consecutive
missed LACPDUs.
The selected rate affects the responsiveness of link failure
detection and the amount of control traffic.";
type lacp-rate;
default slow;
}

leaf system-priority {
description "Sytem priority used by the node on this LAG interface.
Lower value is higher priority for determining which node
is the controlling system.";
type uint16 {
range "1 .. 65535";
}
}

leaf aggregator-id {
description "Aggregator ID.";
config false;
type uint16;
}

leaf actor-key {
description "Actor key.";
config false;
type uint16;
}

leaf partner-key {
description "Partner key.";
config false;
type uint16;
}

leaf partner-mac {
description "Partner MAC address.";
config false;
type yang:phys-address;
}
}

container static {
config false; // For now, we need to read out mode and other status

leaf mode {
description "Active mode for static aggregates.";
type lag-type;
}

uses hash;
}

choice monitor {
description "Monitor link members using carrier or ARP.";
Expand All @@ -183,10 +262,6 @@ submodule infix-if-lag {
}

// TODO: add num and any/all settings

must "(interval = 0) or (count(./peer) > 0)" {
description "At least peer is required when the ARP monitor is enabled.";
}
}
}

Expand Down Expand Up @@ -224,15 +299,6 @@ submodule infix-if-lag {
}
}

must "not(./mode = 'lacp' and ./arp-monitor/interval > 0)" {
error-message "ARP monitor is not supported in LACP mode.";
description "Driver does not support both monitors and require miimon in LACP mode.";
}

must "not(./mode = 'lacp' and ./link-monitor/interval = 0)" {
error-message "Link monitor must be enabled in LACP mode.";
description "Driver requires miimon in LACP mode.";
}
}
}

Expand All @@ -256,24 +322,36 @@ submodule infix-if-lag {
error-message "Must refer to a valid LAG interface.";
}
}

leaf state {
description "Port state, active or backup member.";
description "Link state, active or backup member.";
type member-state;
config false;
}

leaf link-failures {
description "Link failure counter, cannot be reset.";
type uint32;
config false;
type string;
}

container lacp {
description "LACP port state, ours and partner.";
config false;

leaf aggregator-id {
description "Aggregator ID.";
type uint16;
}

leaf-list actor-state {
description "LACP state flags.";
type string;
type lacp-state;
}

leaf-list partner-state {
description "LACP state flags for link partner.";
type string;
type lacp-state;
}
}
}
Expand Down
Loading

0 comments on commit 6df328c

Please sign in to comment.