Why are SONiC Tutorials wrong?

Adam Dunstan
SoNIC NOS
Published in
3 min readMay 30, 2023

--

Updated for SONiC Version 202305

There is a problem with the majority of SONiC tutorials. Have you searched the Internet for tutorials on SONiC only to find rehashed Free Range Routing tutorials and found following them was a waste of time?

By default a configuration created with FRR’s VTYSH cannot be saved to persist restart……………

Prior to version 202305, FRR’s VTYSH is not a supported configuration mode for upstream SONiC.

By default SONiC uses the sonic-bgpcdfd mechanism to configure FRR. The SONiC startup configuration is a JSON file that is loaded into the REDIS database that contains the overall switch configuration. The FRR configuration is then created using a set of templates that convert the SONiC configuration into the resulting FRR configuration. There are a few challenges with this model with FRR, specifically it doesn’t support the full feature-set of FRR and there isn’t an interactive CLI. The configuration is poorly documented so getting the configuration needed will require reading source code. Updating the FRR configuration using the SONiC configuration models and the console requires that a JSON file containing the updates to be created and then loaded.

There are three configuration mechanisms, the default bgpcfgd, frr-mgmt-framework and split-mode.

  • sonic-bgpcdfd. The default, it supports BGP, static routing, BFD and BGPmon. It has YANG model coverage and the most complete BGP configuration. However not all of the configuration is dynamic, but the important actions such as adding peers is dynamic.
  • sonic-frr-mgmt-framework. This is an optional configuration mechanism. It supports BGP, OSPFv2, static routing, BFD, PIM and IGMP. There is no documentation and minimal YANG model support, so using this mechanism requires that you read the source code of the configuration daemon. However it’s actions are dynamic.
  • split-mode. This mode enables the use of FRR’s VTYSH configuration model. In this case, the FRR configuration files are used and changes via VTYSH can be persisted.

The SONiC modes, bgpcdfd and frr-mgmt-framework use the SONiC REDIS configuration database. Split mode creates separate configuration mechanisms for FRR using its mechanisms and files.

Using split-mode may seem like a good idea but its not! This solution requires that two configuration management toolchains be used, one for FRR and another for the Switch using SONiC’s configuration models. It also impacts SONiC other configuration mechanisms such as OpenAPI and gNMI.

Adding split mode to upstream SONiC does make it easier to do simple tests, but is a step backward in network automation.

Why are there so many tutorials using VTYSH?

There are a few reasons.

  1. Learning how to configure SONiC using its unified default configuration mechanisms takes effort, to get a good understanding its necessary to read the SONiC source code. If you cannot read source code, its easier to rehash an old tutorial based upon FRR.
  2. There are forks of the SONiC source code referred to as “Enterprise” versions. Before spit-mode was added to upstream, some of these versions had their own split-mode by default.

Want to learn more. There is a more detailed version of this document including configuration samples, as well as a growing list of Guides, Tutorial and Tools at www.sonicnos.net

--

--

Adam Dunstan
SoNIC NOS

Tech enthusiast, infrastructure specialist, leader & engineer