blob: 767ad3a65b39741e2e23c28ca6433be9f966c7af [file] [log] [blame]
Daniele Moroed033562021-10-04 16:12:31 +02001.. _stratum_chassis_config:
2
Yi Tseng22e7dbc2021-09-28 14:32:15 -07003Stratum Chassis Configuration
4=============================
5
6.. tip::
7
8 Check out `examples <https://github.com/stratum/stratum/tree/main/stratum/hal/config>`_
9 for every platform supported by Stratum.
10
11 See the `Deployment Guide <../deployment.rst>`_ to learn about how to deploy Stratum
12 with a custom chassis config.
13
14The Stratum chassis config is the internal data structure that encapsulates the so called
15"config" pushed to the entire chassis. The term "chassis" refers to the a switching box
16with one or more switching nodes managed by a management interface.
17
18The chassis config file will be placed on the disk of the device and loaded when starting the Stratum.
19The config includes all the not-so-frequent settings that are required before the switch
20can accept flow programming requests from the controller.
21
22A valid chassis config includes a ``chassis`` and a ``node`` field, and may includes one
23or more ``singleton_port`` field. See each section below for more detail.
24
25.. note::
26
27 In Stratum the external interface for pushing config is gNMI.
28 The protobuf realization of the YANG models for the config is internally converted
29 to a chassis config before it is consumed by the internal stack components.
30
31 The `format of chassis config <https://github.com/stratum/stratum/blob/main/stratum/hal/lib/common/common.proto#L824-L833>`_
32 is based on protobuf text format, check out
33 `the protobuf language guide for more info <https://developers.google.com/protocol-buffers/docs/overview?hl=en>`_
34
35Chassis
36-------
37
38A ``chassis`` uniquely identifies a switch with a single management interface.
39Each chassis may contain one or more slots (aka linecards),
40and one or more switching nodes (aka chips) on each slot.
41
42A chassis contains the following fields:
43
44* ``platform``: The chassis platform. **Required**
45* ``name``: An arbitrary name for the chassis. **Optional**
46* ``config_params``: Parameters configured for the entire chassis when config is pushed to the the switch. **Optional**
47
48.. tip::
49
50 Check out the list of platforms `here <https://github.com/stratum/stratum/blob/main/stratum/hal/lib/common/common.proto#L33-L47>`_
51
52Node
53----
54
55A ``node`` uniquely identifies a single switching node (aka chip) on a chassis linecard
56and all its flow-related and config-related parameters.
57
58A node contains the following fields:
59
60* ``id``: The unique ID of the switch node on the chassis as used by the P4Runtime controller. **Required**
61* ``name``: An arbitrary name for the switching node. **Optional**
62* ``slot``: The 1-base index of the slot (aka linecard) which this node belongs. **Required**
63* ``index``: The optional 1-base index of the node within the chassis. **Optional**
64
Daniele Moroed033562021-10-04 16:12:31 +020065.. _singleton_port:
66
Yi Tseng22e7dbc2021-09-28 14:32:15 -070067Singleton Port
68--------------
69
70A ``singleton port`` in the chassis configuration uniquely identifies a single physical port on
71a single chassis.
72
73A singleton port contains the following fields:
74
75* ``id``: The unique ID of the singleton port. **Required**
76* ``name``: An optional arbitrary name for the singleton port. **Required**
77
78 The control plan (e.g., ONOS) can use this name to query port information as a gNMI path key.
79
80* ``slot``: The 1-base index of the slot (aka linecard) of the port. **Required**
81* ``port``: The 1-base index of the singleton port on the slot. **Required**
82* ``channel``: The 1-base channel index. Absence or zero means non-channelized. **Optional**
83* ``speed_bps``: The speed of the port in bps. **Required**
84* ``node``: The id of the corresponding node that the port belongs to. **Required**
85* ``config_params``: Parameters configured for this port. **Optional**
86
87 * ``admin_state``: The initial admin state for this port, port will be disabled by default.
88
89 * Choose from ``ADMIN_STATE_DISABLED`` or ``ADMIN_STATE_ENABLED``.
90
91 * ``mtu``: The maximum transmission unit for this port.
92 * ``autoneg``: Whether auto-negotiation is enabled or not for this port.
93
94 * Choose from ``TRI_STATE_FALSE`` or ``TRI_STATE_TRUE``
95 * The initial configuration might be different if this field is empty, based on the
96 platform or the connector you are using.
97
98 * ``fec_mode``: The
99
100 * Choose from ``FEC_MODE_ON``, ``FEC_MODE_OFF``, or ``FEC_MODE_AUTO``
101
102 * ``loopback_mode``:
103
104 * Choose from ``LOOPBACK_STATE_NONE``, ``LOOPBACK_STATE_MAC``, or ``LOOPBACK_STATE_PHY``
105
106Example chassis config
107----------------------
108
109In this example, we want to set up a **Tofino-based switch** with only one node/slot.
110
111And we want to set up two ports:
112
113* Port 1: 100G port without channelization, enabled by default, and disable auto auto-negotiation.
114* Port 2: break out to four 10G ports, uses different channels for each port and enable
115 them by default with auto-negotiation.
116
117.. image:: ../images/chassis-config-example.svg
118 :width: 500px
119
120Below is an example of a chassis configuration with a list of singleton port:
121
122.. code-block::
123
124 description: "A chassis config example."
125 chassis {
126 platform: PLT_GENERIC_BAREFOOT_TOFINO
127 name: "leaf-1"
128 }
129 nodes {
130 id: 1
131 slot: 1
132 index: 1
133 }
134 singleton_ports {
135 id: 1
136 name: "1/0"
137 slot: 1
138 port: 1
139 speed_bps: 100000000000 # 100G
140 config_params {
141 admin_state: ADMIN_STATE_ENABLED
142 autoneg: TRI_STATE_FALSE
143 }
144 node: 1
145 }
146 singleton_ports {
147 id: 200
148 name: "2/0"
149 slot: 1
150 port: 2
151 channel: 1
152 speed_bps: 10000000000 # 10G
153 config_params {
154 admin_state: ADMIN_STATE_ENABLED
155 autoneg: TRI_STATE_TRUE
156 }
157 node: 1
158 }
159 singleton_ports {
160 id: 201
161 name: "2/1"
162 slot: 1
163 port: 2
164 channel: 2
165 speed_bps: 10000000000 # 10G
166 config_params {
167 admin_state: ADMIN_STATE_ENABLED
168 autoneg: TRI_STATE_TRUE
169 }
170 node: 1
171 }
172 singleton_ports {
173 id: 202
174 name: "2/2"
175 slot: 1
176 port: 2
177 channel: 3
178 speed_bps: 10000000000 # 10G
179 config_params {
180 admin_state: ADMIN_STATE_ENABLED
181 autoneg: TRI_STATE_TRUE
182 }
183 node: 1
184 }
185 singleton_ports {
186 id: 203
187 name: "2/3"
188 slot: 1
189 port: 2
190 channel: 4
191 speed_bps: 10000000000 # 10G
192 config_params {
193 admin_state: ADMIN_STATE_ENABLED
194 autoneg: TRI_STATE_TRUE
195 }
196 node: 1
197 }