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