SONiC¶
Aliases: sonic, sonic-cli · Filenames: *.sonic
SONiC's CLI is a set of Linux utilities rather than a configuration grammar,
so this lexer reads lines verb-first: the utility (config, show,
sonic-clear, sonic-cfggen, sonic-installer, vtysh) comes first, then a
subcommand, then arguments.
Two things are highlighted that the other lexers have no use for: command line
flags such as -y and --min-links, and the sudo most SONiC documentation
puts in front of config. Subcommands that remove or stop something (del,
remove, shutdown, disable) get the removal token, the same one no gets
on a Cisco-style platform.
Port names cover the chassis and multi-ASIC types as well as the front panel
ones: Ethernet0, PortChannel001, Vlan100, Ethernet-BP0.
# SONiC -- configuration through the config utility
sudo config hostname leaf1
sudo config interface ip add Ethernet0 10.1.1.1/31
sudo config interface mtu Ethernet0 9100
sudo config interface startup Ethernet0
sudo config vlan add 100
sudo config vlan member add -u 100 Ethernet4
sudo config interface ip add Vlan100 10.100.0.1/24
sudo config portchannel add PortChannel001 --min-links 2 --fallback enable
sudo config portchannel member add PortChannel001 Ethernet8
sudo config vrf add Vrf-TENANT-A
sudo config interface vrf bind Vlan100 Vrf-TENANT-A
sudo config bgp shutdown neighbor 10.1.1.0
sudo config feature state bgp enabled
sudo config save -y
#
show interfaces status
show interfaces counters
show ip bgp summary
show vlan brief
show runningconfiguration bgp
sonic-clear counters
sudo sonic-cfggen -d --print-data
#
admin@leaf1:~$ vtysh -c 'show bgp l2vpn evpn summary'
config_db.json
SONiC's persisted configuration is JSON, which Pygments already
highlights — use json for those blocks. This lexer is for the commands
that read and write it.