blob: 1ab17666a5016a9a1183eba2655f463710101926 [file] [log] [blame]
Charles Chanfcfe8902022-02-02 17:06:27 -08001.. SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
2.. SPDX-License-Identifier: Apache-2.0
3
Charles Chan2caff7b2021-10-11 20:25:16 -07004.. _onos_network_config:
5
Charles Chancaebcf32021-09-20 22:17:52 -07006Network Configuration
7=====================
Wailok Shum2f05cd32021-09-30 22:18:19 +08008SD-Fabric uses several different types of network configurations.
Carmelo Cascone43989982021-10-12 00:01:19 -07009We only focus on ``devices`` and ``ports`` configuration in this section, which
10are used to provide basic L2/L3 connectivity.
Wailok Shum2f05cd32021-09-30 22:18:19 +080011
12See :ref:`advanced-features` for advanced feature configurations.
13
14Device Configuration
15--------------------
16Each switch in SD-Fabric requires a device config.
17
18.. code-block:: json
19
20 {
21 "devices" : {
22 "device:leaf1" : {
23 "segmentrouting" : {
24 "ipv4NodeSid" : 101,
25 "ipv4Loopback" : "192.168.0.201",
26 "ipv6NodeSid" : 111,
27 "ipv6Loopback" : "2000::c0a8:0201",
28 "routerMac" : "00:00:00:00:02:01",
29 "isEdgeRouter" : true,
30 "adjacencySids" : []
31 },
32 "basic" : {
33 "name": "Leaf1",
34 "managementAddress": "grpc://10.128.100.51:9339?device_id=1",
35 "driver": "stratum-tofino",
Carmelo Casconef2b17912022-02-04 09:27:27 -080036 "pipeconf": "org.stratumproject.fabric-upf-int.montara_sde_9_5_0"
Wailok Shum2f05cd32021-09-30 22:18:19 +080037 }
38 }
39 }
40 }
41
Carmelo Cascone43989982021-10-12 00:01:19 -070042- ``device:leaf1``: arbitrary globally unique identifier of the device, must always be prefixed with ``device:``.
Wailok Shum2f05cd32021-09-30 22:18:19 +080043
44- ``ipv4NodeSid``: IPv4 node segment ID, which is used as an MPLS label in
45 forwarding IPv4 traffic. Can be arbitrary and should be globally unique.
46
47- ``ipv4Loopback``: IPv4 loopback address. Can be arbitrary, should be globally
48 unique and should not be part of the same subnet(s) defined on the data plane
49 ports (see port config).
50
51- ``ipv6NodeSid``: IPv6 node segment ID, which is used as an MPLS label in
52 forwarding IPv6 traffic. Can be arbitrary and should be globally unique. Only
53 required when using IPv6.
54
55- ``ipv6Loopback``: IPv6 loopback address. Can be arbitrary, should be globally
56 unique and should not be part of the same subnet(s) defined on the data plane
57 ports (see port config). Only required when using IPv6.
58
59- ``routerMac``: Router MAC address. Can be arbitrary and should be globally
60 unique. This MAC address will be used to reply the ARP request for the
61 loopback IP or the Interface IP that will be introduced later. (We recommend
62 using the MAC address of the device's management interface as the router
63 MAC.)
64
65- ``isEdgeRouter``: True for leaf switches. False for spine switches.
66
Carmelo Cascone43989982021-10-12 00:01:19 -070067- ``adjacencySids``: Deprecated. Always use an empty array.
Wailok Shum2f05cd32021-09-30 22:18:19 +080068
Carmelo Cascone43989982021-10-12 00:01:19 -070069- ``name``: Human friendly name used in the ONOS UI.
Wailok Shum2f05cd32021-09-30 22:18:19 +080070
Carmelo Cascone43989982021-10-12 00:01:19 -070071- ``managementAddress``: gRPC endpoint of the Stratum device and the P4Runtime
72 internal device ID associated to the ASIC (usually ``1``),
73 in the format of ``grpc://[device_addr]?device_id=[P4Runtime device ID]``
74 The IP address can be replaced by a domain name.
Wailok Shum2f05cd32021-09-30 22:18:19 +080075
76- ``driver``: ``stratum-bmv2`` or ``stratum-tofino``, depending on which switch this is.
77
Carmelo Cascone43989982021-10-12 00:01:19 -070078- ``pipeconf``: the P4 program to deploy on this switch. A list of available
79 pipeconfs can be dumped by running ``pipeconfs`` in the ONOS CLI. When running
80 with Tofino-based devices, we provide pre-installed pipeconfs with ID
81 ``org.stratumproject.<profile>.<device-type>_<bf-sde-version>``:
82
83 - The available *profiles* are:
84
85 - ``fabric``: for basic L2/L3 capabilities
Carmelo Casconef2b17912022-02-04 09:27:27 -080086 - ``fabric-upf``: with 4G/5G mobile user plane (UPF) support
Carmelo Cascone43989982021-10-12 00:01:19 -070087 - ``fabric-int``: with INT support
Carmelo Casconef2b17912022-02-04 09:27:27 -080088 - ``fabric-upf-int``: with UPF and INT support
Carmelo Cascone43989982021-10-12 00:01:19 -070089
Hung-Wei Chiu554a9d02021-11-22 14:10:19 -080090 - The supported *device-types*: Use the command ``weutil`` in the BMC mode to get the product name.
Carmelo Cascone43989982021-10-12 00:01:19 -070091
Hung-Wei Chiu554a9d02021-11-22 14:10:19 -080092 - ``montara``: for dual-pipe Tofino ASIC SKUs (Product name is 100BF-32X)
93 - ``mavericks``: for quad-pipe Tofino ASIC SKUs (Product name is 100BF-32QS)
Carmelo Cascone43989982021-10-12 00:01:19 -070094
95 - The Intel/Barefoot SDE version used in Stratum, e.g., ``sde_9_5_0``
Wailok Shum2f05cd32021-09-30 22:18:19 +080096
97.. caution::
Carmelo Cascone43989982021-10-12 00:01:19 -070098 You should avoid using reserved MPLS labels for ``ipv4NodeSid`` and
Wailok Shum2f05cd32021-09-30 22:18:19 +080099 ``ipv6NodeSid``. Please check here for the reserved values:
100 http://www.iana.org/assignments/mpls-label-values/mpls-label-values.xhtml
101
102.. note::
Carmelo Cascone43989982021-10-12 00:01:19 -0700103 Most of the SD-Fabric configurations support dynamic updates. Unfortunately,
104 we currently **do not support dynamic device configuration updates**. You
105 will have to restart (reboot) the switch if the corresponding device
106 configuration changes.
Wailok Shum2f05cd32021-09-30 22:18:19 +0800107
108 Having said that, when introducing a completely new device in the network,
Carmelo Cascone43989982021-10-12 00:01:19 -0700109 the device configurations pushed before ONOS connects to the switch for the
110 first time should be applied correctly.
111
112Port IDs for Tofino-based devices
113---------------------------------
114
115Before describing the ONOS netcfg, it is worth nothing how we refer to ports for
116Tofino-based devices. Netcfg uses the format ``device:<name>/<port-number>``.
117
118``<port-number>`` is a special value that is usually different than the number
119shown in the switch front panel. It is the same number used for P4 table
120programming and depends on the specific Tofino ASIC SKU (e.g., dual-pipe vs.
121quad-pipe) and switch vendor/platform. In Stratum this is often referred to as
122the *SDK port ID*, as this is the number used for all Tofino SDK calls. In Intel
123documentation this is referred to as the ``DP_ID``. We plan to remove this
124dependency on such a low level detail in future releases, but for now, to find
125out the mapping between front-panel ports and ``DP_ID`` you have the following
126options:
127
128- Ask your switch vendor
129- Use the command `pm.show` on the BF shell of a running Stratum instance
130 (see :ref:`troubleshooting_guide`)
Wailok Shum2f05cd32021-09-30 22:18:19 +0800131
132Bridging and Unicast Routing
133----------------------------
134
Carmelo Cascone43989982021-10-12 00:01:19 -0700135In the following we illustrate how to enable basic bridging and routing on a
136per-port basis.
137
Wailok Shum2f05cd32021-09-30 22:18:19 +0800138.. attention::
139 - VLAN **4094** is reserved for unconfigured ports (e.g. spine facing ports)
Carmelo Cascone43989982021-10-12 00:01:19 -0700140 - VLAN **4090** is reserved for pseudowire transport flow rules on the spines
Wailok Shum2f05cd32021-09-30 22:18:19 +0800141
142Access Ports
143^^^^^^^^^^^^
144
145The necessary but minimum configuration for an access port is simply a VLAN.
146
147.. code-block:: json
148
149 {
150 "ports" : {
Carmelo Cascone43989982021-10-12 00:01:19 -0700151 "device:leaf1/12" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800152 "interfaces" : [{
153 "name" : "serverA-intf",
154 "vlan-untagged": 10
155 }]
156 },
Carmelo Cascone43989982021-10-12 00:01:19 -0700157 "device:leaf1/16" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800158 "interfaces" : [{
159 "name" : "serverB-intf",
160 "vlan-untagged": 10
161 }]
162 }
163 }
164 }
165
Carmelo Cascone43989982021-10-12 00:01:19 -0700166The example above shows two ports (12 and 16) on switch ``leaf1`` that have
Wailok Shum2f05cd32021-09-30 22:18:19 +0800167been assigned to VLAN 10 using the ``vlan-untagged`` keyword.
168
169It simply means that packets come in and leave out of these switches untagged,
170but internally they are assigned VLAN 10 and they belong to the bridging domain
171defined for VLAN 10.
172
173``name`` is used to associate the interface with a globally unique, user
174friendly name. It can be omitted.
175
176With the configuration shown above, the packets will always be bridged, but
177they cannot be routed out of the VLAN (e.g. to other subnets). To add the
178capability to route out of VLAN 10, we need to add a subnet/gateway IP (similar
179to `interface-vlans or SVIs in traditional networks
180<https://www.youtube.com/watch?v=bUXpmiJpGb0>`_).
181
182.. code-block:: json
183
184 {
185 "ports" : {
Carmelo Cascone43989982021-10-12 00:01:19 -0700186 "device:leaf1/12" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800187 "interfaces" : [{
188 "name" : "serverA-intf",
189 "ips" : [ "10.0.1.254/24"],
190 "vlan-untagged": 10
191 }]
192 },
Carmelo Cascone43989982021-10-12 00:01:19 -0700193 "device:leaf1/16" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800194 "interfaces" : [{
195 "name" : "serverB-intf",
196 "ips" : [ "10.0.1.254/24"],
197 "vlan-untagged": 10
198 }]
199 }
200 }
201 }
202
203In this example, VLAN 10 is associated with subnet ``10.0.1.0/24``, and the
204gateway IP for hosts in this subnet is ``10.0.1.254/32``.
205
206When the desire is to route out of a VLAN, this assignment is currently
207necessary on all ports configured in the same VLAN.
208
209.. note::
210 Typically we only expect a single subnet for a VLAN. Similar to traditional
211 networks, for us, a subnet == VLAN. Different VLANs should be configured in
212 different subnets.
213
214 In certain use-cases, it may be necessary to configure multiple subnets in
215 the same VLAN. This is possible by adding more subnet/gateway IPs in the
216 ``ips`` array.
217
Carmelo Cascone43989982021-10-12 00:01:19 -0700218.. attention::
219 The same subnet cannot be configured on multiple leaf switches.
Wailok Shum2f05cd32021-09-30 22:18:19 +0800220
221 We usually configure one subnet for all the ports on the same leaf switch.
222
223Tagged Ports
224^^^^^^^^^^^^
225Tagged port configuration is similar.
226
227.. code-block:: json
228
229 {
230 "ports" : {
Carmelo Cascone43989982021-10-12 00:01:19 -0700231 "device:leaf1/24" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800232 "interfaces" : [{
233 "name" : "serverA-intf",
234 "ips" : [ "10.0.2.254/24", "10.0.4.254/24" ],
235 "vlan-tagged" : [ 20, 40 ]
236 }]
237 }
238 }
239 }
240
Carmelo Cascone43989982021-10-12 00:01:19 -0700241The configuration above for port 24 on switch ``leaf1`` shows two VLANs 20 and
24240 configured on that port, with corresponding subnets and gateway IPs.
Wailok Shum2f05cd32021-09-30 22:18:19 +0800243
244Note that there is no specific ordering required in the ``ips`` or
245``vlan-tagged`` arrays to correlate the VLANs to their corresponding subnets.
246
247In a future release, we will correlate VLAN and subnets configuration in a more
248readable way.
249
250Native VLAN on Tagged Ports
251^^^^^^^^^^^^^^^^^^^^^^^^^^^
252
253An additional configuration ``vlan-native`` possible on tagged ports includes
254the ability to specify a VLAN (and thus a bridging domain) for incoming
255untagged packets.
256
257Typically, such configuration in trunk ports in traditional networks is
258referred to a native VLAN.
259
260.. code-block:: json
261
262 {
263 "ports" : {
Carmelo Cascone43989982021-10-12 00:01:19 -0700264 "device:leaf1/24" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800265 "interfaces" : [ {
266 "name" : "serverA-intf",
267 "ips" : [ "10.0.2.254/24", "10.0.4.254/24", "10.0.1.254/24" ],
268 "vlan-tagged" : [ 20, 40 ],
269 "vlan-native" : 10
270 }]
271 }
272 }
273 }
274
275Note that it is also necessary to configure the subnet/gateway IP corresponding
276to the native VLAN if you wish to route out of that VLAN.
277
Carmelo Cascone43989982021-10-12 00:01:19 -0700278Configuring interface for IPv6 [#f1]_
279^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Wailok Shum2f05cd32021-09-30 22:18:19 +0800280
281It is similar to configure IPv6 routing. Simply replace the addresses in
282``ips`` with IPv6 addresses. For example:
283
284.. code-block:: json
285
286 {
287 "ports" : {
Carmelo Cascone43989982021-10-12 00:01:19 -0700288 "device:leaf1/24" : {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800289 "interfaces" : [ {
290 "name" : "serverA-intf",
291 "ips" : [ "10.0.2.254/24", "2000::1ff/120" ],
292 "vlan-tagged" : [ 20, 40 ]
293 }]
294 }
295 }
296 }
297
298.. note::
299 There is a known issue that breaks dynamic VLAN configuration.
300 Until the issue get resolved, you need to restart the switch agent to reinstall the flows.
301
Carmelo Cascone43989982021-10-12 00:01:19 -0700302IPv6 Router Advertisement [#f1]_
303^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Wailok Shum2f05cd32021-09-30 22:18:19 +0800304
305Router Advertisement overview
306"""""""""""""""""""""""""""""
307
308Router advertisement application is for enabling **Router Advertisement** and
309**Router Solicitation** functionalities supported by IPv6 routers.
310
311More details are available in `RFC 4861 <https://tools.ietf.org/html/rfc4861>`_.
312
313Application identifies which IPv6 interfaces are currently configured in the
314system and it will try to send out **unsolicited Router Advertisement** (RA)
315messages from these interfaces.
316
317Each such RA message will have two mandatory options named **Source link-layer
318address** and **MTU**.
319
320Additional RA option **prefix** can be enabled using component configuration
321**raGlobalPrefixConfStatus**.
322
323Application also processes **Router Solicitations** (RS) sent from hosts. Upon
324receiving RS on a particular interface application stops RA transmission in
325that interface and immediately sends RA targeted to the solicited host. After
326that application continues unsolicited RA transmission on that interface.
327
328Activate and configure RA
329"""""""""""""""""""""""""
330
331RA application can be activated from CLI by running
332
333.. code-block:: console
334
335 onos> app activate routeradvertisement
336
337Behavior of RA application is controlled by ONOS component configuration
338subsystem and following are possible configuration options.
339
340- ``raThreadDelay``: Delay between consecutive RA transmissions
341
342- ``raPoolSize``: Capacity of thread pool to be used for RA transmissions
343
344- ``raFlagMbitStatus``: RA flag “Managed address configuration”
345 enabled/disabled
346
347- ``raFlagObitStatus``: RA flag “Other configuration” enabled/disabled
348
349- ``raOptionPrefixStatus``: RA Option “prefix” is enabled/disabled. Router
350 prefixes will be available in RA only if this flag is “true”
351
352- ``raGlobalPrefixConfStatus``: Enable switch level global prefix
353 configuration.
354 Once ``raGlobalPrefixConfStatus`` is enabled, RA prefix option is generated
355 from port configuration of device, see for more details.
356
357To set the options, following the command (example for ``raOptionPrefixStatus``)
358
359.. code-block:: console
360
361 onos> cfg set org.onosproject.ra.RouterAdvertisementManager raOptionPrefixStatus true
362
363Prefix details are picked up from network interface configuration.
364
365RA app will filter out link-local IPs while preparing prefixes.
366
367For example, in following configuration, Prefix will include only
368**2001:0558:FF10:04C9::2:1ff/120**.
369
370.. code-block:: json
371
372 {
373 "ports": {
Carmelo Cascone43989982021-10-12 00:01:19 -0700374 "device:leaf2/16": {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800375 "interfaces": [{
376 "ips": [ "192.168.114.1/24", "2001:0558:FF10:04C9::2:1ff/120", "FE80::4EA8:2AFF:FE24:8E5F/120" ],
377 "vlan-untagged": "11",
378 "name": "18-15"
379 }]
380 }
381 }
382 }
383
384Global prefix configuration
385"""""""""""""""""""""""""""
386
387In some cases, users may want to have a set of global prefix **advertised on
388all edge interfaces**.
389
390Such prefixes can be configured in **devices** section of network configuration
391in the following way.
392
393.. code-block:: json
394
395 {
396 "devices": {
Carmelo Cascone43989982021-10-12 00:01:19 -0700397 "device:leaf2": {
Wailok Shum2f05cd32021-09-30 22:18:19 +0800398 "routeradvertisement" : {
399 "prefixes": [ "2001:0558:FF10:04C9::3:1ff/120"]
400 }
401 }
402 }
403 }
404
405.. note::
406 When global prefix is configured, RA app will ignore any prefixes
407 configured on switch interfaces.
408
409Notes about interface config
410^^^^^^^^^^^^^^^^^^^^^^^^^^^^
411
412There is no need to configure ports on switches that are meant to connect to
413other switches.
414
415The VLAN (untagged or tagged) configuration is only meant for ports that are
416connected to hosts (edge ports).
417
418.. image:: ../images/config-vlan.png
419
420Furthermore, note that the same VLAN can be configured on multiple ToRs - e.g.
421VLAN 20 in the figure above.
422
423However this does not mean that the ports are in the same bridging domain,
424because in the fabric, the communication between ToRs is through a routed
425network.
426
427In other words, a host on VLAN 20 (untagged or tagged) connected to one ToR can
428communicate with another host on VLAN 20 (untagged or tagged) connected to a
429different ToR, but the MAC addresses will change as the traffic goes through a
430routed network.
431
432Please do not use this feature to connect switches in unsupported topologies as
433shown in the example below.
434
435The fabric is not designed to be one big Ethernet fabric. The bridging domain
Carmelo Cascone43989982021-10-12 00:01:19 -0700436is restricted to one ToR.
Wailok Shum2f05cd32021-09-30 22:18:19 +0800437
438If the bridging domain is extended across two ToRs directly linked to each
439other, there is a chance of loops.
440
441In other words, the ToRs/Leafs are not standalone 802.1Q bridges, and should
442not be used as such.
443
444.. image:: ../images/config-vlan-invalid.png
Carmelo Cascone43989982021-10-12 00:01:19 -0700445
446.. rubric:: Footnotes
447
448.. [#f1] IPv6 support on the data plane (P4 program) is still work-in-progress.