|
| 1 | + |
| 2 | +# Layer Routing Interface Counters |
| 3 | + |
| 4 | +# High Level Design Document |
| 5 | +#### Rev 0.1 |
| 6 | + |
| 7 | +# Table of Contents |
| 8 | + * [List of Tables](#list-of-tables) |
| 9 | + * [Revision](#revision) |
| 10 | + * [About This Manual](#about-this-manual) |
| 11 | + * [Scope](#scope) |
| 12 | + * [Definition/Abbreviation](#definitionabbreviation) |
| 13 | + * [1 Requirement Overview](#1-requirement-overview) |
| 14 | + * [1.1 Functional Requirements](#11-functional-requirements) |
| 15 | + * [1.2 Configuration and Management Requirements](#12-configuration-and-management-requirements) |
| 16 | + * [1.3 Scalability Requirements](#13-scalability-requirements) |
| 17 | + * [1.4 Warm Boot Requirements](#14-warm-boot-requirements) |
| 18 | + * [1.5 Limitiations](#15-limitations) |
| 19 | + * [2 Functionality](#2-functionality) |
| 20 | + * [2.1 Target Deployment Use Cases](#21-target-deployment-use-cases) |
| 21 | + * [2.2 Functional Description](#22-functional-description) |
| 22 | + * [3 Design](#3-design) |
| 23 | + * [3.1 Overview](#31-overview) |
| 24 | + * [3.2 DB Changes](#32-db-changes) |
| 25 | + * [3.3 Switch State Service Design](#33-switch-state-service-design) |
| 26 | + * [3.4 SyncD](#34-syncd) |
| 27 | + * [3.5 SAI](#35-sai) |
| 28 | + * [3.6 CLI](#36-cli) |
| 29 | + * [4 Flow Diagrams](#4-flow-diagrams) |
| 30 | + * [6 Warm Boot Support](#6-warm-boot-support) |
| 31 | + * [7 Scalability](#7-scalability) |
| 32 | + * [8 Unit Test](#8-unit-test) |
| 33 | + |
| 34 | +# List of Tables |
| 35 | +[Table 1: Abbreviations](#table-1-abbreviations) |
| 36 | + |
| 37 | +# Revision |
| 38 | +| Rev | Date | Author | Change Description | |
| 39 | +| :--: | :---------: | :---------: | ------------------ | |
| 40 | +| 0.1 | 28-Apr-2021 | Dilip Kumar,Laveen | Initial version | |
| 41 | +| | | | | |
| 42 | + |
| 43 | +# About this Manual |
| 44 | +This document provides general information about supporting Layer 3 Routing Interface counters (interface statistics). |
| 45 | + |
| 46 | +# Scope |
| 47 | +This document describes the high level description of Layer 3 RIF counter support in SONiC. |
| 48 | + |
| 49 | +# Definition/Abbreviation |
| 50 | +### Table 1: Abbreviations |
| 51 | +| **Term** | **Meaning** | |
| 52 | +| -------- | ------------------------------------------------- | |
| 53 | +| BGP | Border Gateway protocol | |
| 54 | +| CLI | Command Line Interface | |
| 55 | +| IP | Internet Protocol | |
| 56 | +| L3 | Layer 3 | |
| 57 | +| KLISH | Industry Standard Command Line Interface (IS CLI) | |
| 58 | +| RIF | Routing Interface | |
| 59 | +| VRF | Virtual Routing and Forwarding | |
| 60 | +| SVI | Switch Virtual Interface | |
| 61 | + |
| 62 | + |
| 63 | +# 1 Requirement Overview |
| 64 | + |
| 65 | +Provide Layer 3 Routing Interface counter support in SONIC and SAI. Routing interface includes router port, L3 PO, VLAN/SVI, Subinterface. |
| 66 | + |
| 67 | +## 1.1 Functional Requirements |
| 68 | + |
| 69 | + - Count Layer 3 (IPv4/IPv6) traffic received on each Routing Interface in both RX and TX directions |
| 70 | + - Count traffic per router interface in Bytes per seconds and packets per seconds in both RX and TX directions |
| 71 | + - Periodically read RIF counters from HW and update in COUNTER DB |
| 72 | + |
| 73 | + |
| 74 | +## 1.2 Configuration and Management Requirements |
| 75 | + |
| 76 | + - Provide IS CLI to display RIF Counters |
| 77 | + - Provide IS CLI to clear RIF statistics/counters |
| 78 | + - Provide IS CLI to configure the interval between two concecutive read/fetch from HW |
| 79 | + |
| 80 | +## 1.3 Scalability Requirements |
| 81 | + |
| 82 | + - Support counters/statistics for all routing interfaces supported in the system. TD3 supports 4K Layer-3 routing interfaces. Counters/statistics collection will be supported on all the 4K interfaces. |
| 83 | + |
| 84 | +## 1.4 Warm Boot Requirements |
| 85 | + |
| 86 | + - Warmboot will result in discontinuity of the interface counters. That is, after warmboot, the interface counters will be rest back to zero and will start from there. |
| 87 | + |
| 88 | +## 1.5 Limitiations |
| 89 | + |
| 90 | + - RIF Counters are not supported on Loopback Interfaces |
| 91 | + - RIF Counters are not supported on TD4, TH4 platforms due to HW limitations / unavailability of counter resources |
| 92 | + - RIF Counters does not show error counts, it could be either packets that are valid but not forwarded or invalid packets |
| 93 | + |
| 94 | + |
| 95 | +# 2 Functionality |
| 96 | + |
| 97 | +## 2.1 Target Deployment Use Cases |
| 98 | + |
| 99 | +## 2.2 Functional Description |
| 100 | + |
| 101 | +# 3 Design |
| 102 | +## 3.1 Overview |
| 103 | + |
| 104 | +## 3.2 DB Changes |
| 105 | + |
| 106 | +### 3.2.1 CONFIG DB |
| 107 | + |
| 108 | +### 3.2.2 APP DB |
| 109 | +Not applicable |
| 110 | + |
| 111 | +### 3.2.3 STATE DB |
| 112 | +Not applicable |
| 113 | + |
| 114 | +### 3.2.4 ASIC DB |
| 115 | +Not applicable |
| 116 | + |
| 117 | +### 3.2.5 COUNTER DB |
| 118 | + |
| 119 | + |
| 120 | +### 3.2.6 Configuration save and restart |
| 121 | +Not applicable |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +## 3.3 Switch State Service Design |
| 126 | +### 3.3.1 Orchestration Agent |
| 127 | + |
| 128 | +### 3.3.2 Other Process |
| 129 | + |
| 130 | +## 3.4 SyncD |
| 131 | + |
| 132 | + |
| 133 | +## 3.5 SAI |
| 134 | + |
| 135 | + RX: |
| 136 | + packets - SAI_ROUTER_INTERFACE_STAT_IN_PACKETS |
| 137 | + bytes - SAI_ROUTER_INTERFACE_STAT_IN_OCTETS |
| 138 | + |
| 139 | + TX: |
| 140 | + packets - SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS |
| 141 | + bytes - SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS |
| 142 | + |
| 143 | +## 3.6 CLI |
| 144 | + |
| 145 | +### 3.6.1 Data Models |
| 146 | + |
| 147 | +Below is high level hierarchy of RIF counters sonic yang model |
| 148 | + |
| 149 | + +--ro in-octets? uint64 |
| 150 | + +--ro in-pkts? uint64 |
| 151 | + +--ro in-octets-per-second? decimal64 |
| 152 | + +--ro in-pkts-per-second? decimal64 |
| 153 | + +--ro in-bits-per-second? decimal64 |
| 154 | + +--ro in-utilization? scommon:percentage |
| 155 | + +--ro out-octets? uint64 |
| 156 | + +--ro out-pkts? uint64 |
| 157 | + +--ro out-octets-per-second? decimal64 |
| 158 | + +--ro out-pkts-per-second? decimal64 |
| 159 | + +--ro out-bits-per-second? decimal64 |
| 160 | + +--ro out-utilization? scommon:percentage |
| 161 | + |
| 162 | + |
| 163 | +### 3.6.2 Configuration Commands |
| 164 | + |
| 165 | +Below is the command for configuring interval between 2 consecutive read/fetch for Layer 3 routing interface counters |
| 166 | + |
| 167 | + counters rif interval <value> |
| 168 | + |
| 169 | +Default value for interval is 5 seconds |
| 170 | + |
| 171 | +The click configuration command for the same is |
| 172 | + |
| 173 | + config counters rif interval <value> |
| 174 | + |
| 175 | +### 3.6.3 Show Commands |
| 176 | + |
| 177 | +Below is the show command for displaying Layer 3 routing interface counters |
| 178 | + |
| 179 | + show interface counters rif |
| 180 | + |
| 181 | +Here is a sample output of the above command |
| 182 | + |
| 183 | + sonic# show interface counters rif |
| 184 | + ---------------------------------------------------------------------------------------------- |
| 185 | + Interface RX_OK RX_BPS RX_PPS RX_ERR TX_OK TX_BPS TX_PPS TX_ERR |
| 186 | + ---------------------------------------------------------------------------------------------- |
| 187 | + Ethernet46 561 100 32 N/A 34678 364 941 N/A |
| 188 | + Ethernet96 0 0 0 N/A 0 0 0 N/A |
| 189 | + Po33.101 258 N/A 4 N/A 698 N/A N/A N/A |
| 190 | + Vlan200 5432 58 123 N/A 0 0 0 N/A |
| 191 | + PortChannel001 0 0 0 N/A 4852 68 12 N/A |
| 192 | + ---------------------------------------------------------------------------------------------- |
| 193 | + |
| 194 | +The click show command for the same is |
| 195 | + |
| 196 | + show interfaces counters add rif |
| 197 | + |
| 198 | +### 3.6.4 Clear Commands |
| 199 | + |
| 200 | +Below is the command for clearing Layer 3 routing interface counters |
| 201 | + |
| 202 | + clear counters interface rif |
| 203 | + |
| 204 | +The click command for the same is |
| 205 | + |
| 206 | + sonic-clear rifcounters |
| 207 | + |
| 208 | +### 3.6.5 Debug Commands |
| 209 | +Not applicable |
| 210 | + |
| 211 | +### 3.6.6 REST API Support |
| 212 | +Show Command |
| 213 | + |
| 214 | + curl -X POST "https://x.x.x.x/restconf/operations/openconfig-counters-ext:rif-counters" -H "accept: application/yang-data+json" -H "Authorization: Basic c2s0MDgxMTU6RXBsZXJub3YxOA==" -H "Content-Type: application/yang-data+json" -d "{\"openconfig-counters-ext:input\":{\"riface\":\"all\"}}" -k |
| 215 | + |
| 216 | +Clear Command |
| 217 | + |
| 218 | + curl -X POST "https://x.x.x.x/restconf/operations/openconfig-interfaces-ext:clear-rif-counters" -H "accept: application/yang-data+json" -H "Authorization: Basic YWRtaW46YnJvYWRjb20=" -H "Content-Type: application/yang-data+json" -d "{\"openconfig-interfaces-ext:input\":{\"rif\":\"all\"}}" -k |
| 219 | + |
| 220 | +Config Command |
| 221 | + |
| 222 | + curl -X PATCH "https://x.x.x.x/restconf/data/openconfig-counters-ext:rif-counters/rif-counter=time_value/config" -H "accept: */*" -H "Content-Type: application/yang-data+json" -d "{\"openconfig-counters-ext:config\":{\"rif-counter-interval\":time_value}}" -k |
| 223 | + |
| 224 | +# 4 Flow Diagrams |
| 225 | +Not applicable |
| 226 | + |
| 227 | +# 5 Serviceability and Debug |
| 228 | +Not applicable |
| 229 | + |
| 230 | +# 6 Warm Boot Support |
| 231 | + |
| 232 | +# 7 Scalability |
| 233 | +Not applicable |
| 234 | +# 8 Unit Test |
| 235 | + |
| 236 | +1> Test L3 forwarding for set of selected routes (IPV4 default vrf) and verify rif counters |
| 237 | + |
| 238 | +2> Clear rif counters with traffic paused (selected IPV4 routes in default vrf) and verify. Resume traffic and verify rif counters again. |
| 239 | + |
| 240 | +3> Configure interval to 60 seconds and verify rif counters for traffic (selected IPV4 routes in default vrf) before and after interval expires. |
| 241 | + |
| 242 | +4> Test L3 forwarding for set of selected routes (IPV4 non default vrf) and verify rif counters |
| 243 | + |
| 244 | +5> Test L3 forwarding for set of selected routes (IPV6 default vrf) and verify rif counters |
| 245 | + |
| 246 | +6> Test L3 forwarding for set of selected routes (IPV6 non default vrf) and verify rif counters |
| 247 | + |
| 248 | +7> Bidirectional traffic from orphan port of Peer1 to local MC-LAG port of Peer1 and verify rif counters. |
| 249 | + |
| 250 | + |
| 251 | +# 9 Internal Design Information |
| 252 | + |
0 commit comments