Skip to content

Commit

Permalink
statd: add good-octets counters
Browse files Browse the repository at this point in the history
This patch adds out-good-octets and in-good-octets as augment in
the infix-ethernet-interface yang model. These counters represents
OctetsTransmittedOK and OctetsReceivedOK from ethtool.

Signed-off-by: Richard Alpe <[email protected]>
  • Loading branch information
rical committed Feb 27, 2024
1 parent 3a04bec commit 279aee2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/confd/bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ sysrepoctl -s $SEARCH \
-i [email protected] -g wheel -p 0660 \
-i [email protected] -g wheel -p 0660 \
-i [email protected] -g wheel -p 0660 \
-i infix-ethernet-interface@2024-01-22.yang -g wheel -p 0660 \
-i infix-ethernet-interface@2024-02-27.yang -g wheel -p 0660 \
-I "${INIT_DATA}"
rc=$?

Expand Down
21 changes: 21 additions & 0 deletions .../[email protected] → .../[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ module infix-ethernet-interface {
import ietf-interfaces {
prefix if;
}
import ietf-yang-types {
prefix yang;
reference "IETF RFC 6991";
}

organization "KernelKit";
contact "[email protected]";
description "Extensions and deviations to ieee802-ethernet-interface.yang";

revision 2024-02-27 {
description "Add augment for in-good-octets and out-good-octets";
reference "internal";
}

revision 2024-01-22 {
description "Support ethernet but not negotiation-status";
reference "internal";
Expand All @@ -27,6 +36,18 @@ module infix-ethernet-interface {
/*
* Data Nodes
*/
augment "/if:interfaces/if:interface/eth:ethernet/eth:statistics/eth:frame" {
leaf out-good-octets {
type yang:counter64;
units octets;
description "A count of data and padding octets of frames that are successfully transmitted.";
}
leaf in-good-octets {
type yang:counter64;
units octets;
description "A count of data and padding octets in frames that are successfully received.";
}
}

/* Deviations for config and status */

Expand Down
9 changes: 8 additions & 1 deletion src/statd/cli-pretty
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def get_json_data(default, indata, *args):

return data

def remove_yang_prefix(key):
parts = key.split(":", 1)
if len(parts) > 1:
return parts[1]
return key

class Route:
def __init__(self,data,ip):
self.data = data
Expand Down Expand Up @@ -376,8 +382,9 @@ class Iface:
frame = get_json_data([], self.data,'ieee802-ethernet-interface:ethernet',
'statistics', 'frame')
if frame:
print(f"")
print("")
for key, val in frame.items():
key = remove_yang_prefix(key)
print(f"eth-{key:<{25}}: {val}")


Expand Down
5 changes: 5 additions & 0 deletions src/statd/yanger
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,11 @@ def add_ethtool_groups(ifname, iface_out):
if "FramesLostDueToIntMACRcvError" in mac_in:
frame['in-error-mac-internal-frames'] = str(mac_in['FramesLostDueToIntMACRcvError'])

if "OctetsTransmittedOK" in mac_in:
frame['infix-ethernet-interface:out-good-octets'] = str(mac_in['OctetsTransmittedOK'])
if "OctetsReceivedOK" in mac_in:
frame['infix-ethernet-interface:in-good-octets'] = str(mac_in['OctetsReceivedOK'])

tot = 0
found = False
if "FramesReceivedOK" in mac_in:
Expand Down

0 comments on commit 279aee2

Please sign in to comment.