CONFig

Configure Management interface

CONFig

Shortest form: conf.

Show or change the SDK configuration variables, the settings that come from config.bcm. See Configuration variables; every variable is described in the Variable reference. (The one-line description in the built-in help, “Configure Management interface”, is wrong.)

Most variables are read only while the chip is initialised. A change usually takes effect only at the next init, which breaks a running switch, or at the next syncd start, if you also save it where syncd reads its configuration. Changing a variable does not touch the switch by itself.

Sub-command words must be spelt out (any case).

  • config <var>=<value> … changes variables that already exist. A new name is refused with Must use 'add' to create new variable; use config add. Type variable names in full.

  • config = asks for a new value for every variable, which blocks bcmcmd.

  • config suffixes, listed in the built-in help, only prints Command not supported for this device.

For example, portmap_69 is not in the SONiC Trident 3 configuration, so setting it without add is refused:

drivshell> config portmap_69=77:40
CONFig: Must use 'add' to create new variable: portmap_69=77:40

Failed to execute the diagnostic command. Error: Operation failed.

Unvalidated — Change an existing port mapping, then reinitialise

drivshell> config portmap_69=77:40
drivshell> init all

Unvalidated — Create the variable, then reinitialise

drivshell> config add portmap_69=77:40
drivshell> init all
config show [<substring>]

List the variables as indented <name>=<value> lines, in no particular order, only those whose name contains <substring> (case-sensitive) if one is given. config with no argument does the same. Read-only.

Hardware-validated

drivshell> config show portmap
    portmap_9=9:10:1
    portmap_10=10:10:1
    portmap_123=121:100
    portmap_115=113:100
    portmap_107=105:100
    portmap_11=11:10:1
    portmap_12=12:10:1
    portmap_21=21:100
    portmap_13=13:100
    portmap_127=125:100
    portmap_119=117:100
    portmap_41=41:100
    portmap_33=33:100
    portmap_25=25:100
    portmap_17=17:100
    portmap_61=61:100
    portmap_53=53:100
    portmap_45=45:100
    portmap_37=37:100
    portmap_29=29:100
    portmap_71=69:100
    portmap_57=57:100
    portmap_49=49:100
    portmap_66=129:10:m
    portmap_91=89:100
    portmap_83=81:100
    portmap_75=73:100
    portmap_67=65:100
    portmap_95=93:100
    portmap_87=85:100
    portmap_79=77:100
    portmap_1=1:100
    portmap_99=97:100
    portmap_5=5:100
    portmap_111=109:100
    portmap_103=101:100
config get <var>

Look a variable up for use in scripts. The value is not printed. Instead the shell variables config_var_val (the value as a number; 0 if it is not numeric) and config_var_not_set (1 if the variable does not exist) are set. For an existing variable the shell confirms with Environment variable (config_var_val) was set; for a missing one it prints Environment variables (config_var_val) (config_var_not_set) was set. Read-only.

Hardware-validated

drivshell> config get l2_mem_entries
Environment variable (config_var_val) was set
drivshell> echo $config_var_val $config_var_not_set
32768 0
config add <var>=<value> …

Create variables, or overwrite existing ones.

Hardware-validated

drivshell> config add my_test_var=1
config delete [pattern=<substring>] [<var> …]

Delete every variable whose name contains <substring>, then each variable named (Variable not found if it does not exist). The built-in help shows these as two separate forms; one command accepts both.

Hardware-validated

drivshell> config delete my_test_var
config clear

Delete all variables from memory. Anything that reads a variable afterwards gets the built-in default. Do not use on a running switch.

Unvalidated

drivshell> config clear
config dump

Show every variable as hash: <n>, line: <n>, flag: 0x<f>, <name>=<value>, followed by the configuration file name, counts of compiled-in and imported values, and a legend for the flags: 0x0001 compiled-in value, 0x0002 flushed, 0x0004 used by the SDK. Read-only.

On SONiC the variables are handed to the SDK by syncd rather than read from the file, so every line number is 0 and the summary reports 0 values imported from config.bcm. A variable with flag 0x0000 has been set but not read by the SDK so far.

Hardware-validated

drivshell> config dump
hash:   0, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{16.0}=0x1
hash:   2, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{34.0}=0x0
hash:   2, line:   0, flag: 0x0004, phy_chain_tx_lane_map_physical{49.0}=0x2103
hash:   4, line:   0, flag: 0x0004, phy_chain_rx_lane_map_physical{89.0}=0x2031
hash:   6, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{94.0}=0x1
hash:   6, line:   0, flag: 0x0004, lpm_scaling_enable=1
hash:   7, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{59.0}=0x0
hash:   9, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{77.0}=0x0
hash:   9, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{1.0}=0x0
hash:   9, line:   0, flag: 0x0004, phy_chain_rx_lane_map_physical{113.0}=0x2031
hash:  12, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{2.0}=0x0
hash:  17, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{9.0}=0x0
hash:  19, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{117.0}=0x1
hash:  21, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{117.0}=0x1
hash:  31, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{60.0}=0x1
hash:  32, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{25.0}=0x1
hash:  33, line:   0, flag: 0x0004, phy_chain_tx_lane_map_physical{93.0}=0x0312
hash:  34, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{43.0}=0x1
hash:  39, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{68.0}=0x0
hash:  41, line:   0, flag: 0x0004, serdes_preemphasis_91=0x0f4d08
hash:  41, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{86.0}=0x0
hash:  41, line:   0, flag: 0x0004, portmap_9=9:10:1
hash:  42, line:   0, flag: 0x0004, serdes_preemphasis_83=0x0d4f08
hash:  43, line:   0, flag: 0x0004, serdes_preemphasis_75=0x0d4f08
hash:  44, line:   0, flag: 0x0004, serdes_preemphasis_67=0x0d4f08
hash:  51, line:   0, flag: 0x0004, phy_chain_rx_polarity_flip_physical{126.0}=0x0
hash:  52, line:   0, flag: 0x0000, memlist_enable=1
hash:  53, line:   0, flag: 0x0004, phy_chain_tx_polarity_flip_physical{126.0}=0x0
hash:  54, line:   0, flag: 0x0004, phy_chain_rx_lane_map_physical{21.0}=0x2031
hash:  56, line:   0, flag: 0x0004, riot_overlay_ecmp_resilient_hash_size=16384
...
config refresh

Prints Refreshing configuration database and rebuilds the in-memory variables from the built-in defaults. On SONiC there are none and the file is not reread, so this empties the configuration, like config clear. Do not use on a running switch.

Unvalidated

drivshell> config refresh
config save [filename=<file>] [append=yes] [pattern=<substring>]

Without filename, write all variables back to the configuration file. With filename, write them to that file instead, only those whose names contain pattern if given, appending when append=yes. Files are written inside the syncd container.

On a SONiC Trident 3 switch config save filename=/tmp/config-now.bcm printed nothing and wrote no file. Check with ls afterwards, or capture the output of config show instead.

Hardware-validated

drivshell> config save filename=/tmp/config-now.bcm

Built-in help

Parameters: show <substring> | dump | refresh |
                     save [filename=<filename>] [append=yes] [pattern=<substring>] |
                     add [<var>=<value>] |
                     delete [pattern=<substring>] |<var>
    If no parameters are given, displays the current config vars.
      show                display current config vars. Next parameter (optional) maybe a substring to match
      dump                display current config vars imported from config.bcm and used(hit) by SDK.
                          e.g., Hash, Line #, Flag(Compiled/Flushed/Hit), Vars Name=Value
      refresh             reload config vars from non-volatile storage
      save                save config vars to non-volatile storage.
                          it can optionally save current config to any given file
                          providing the optional <pattern> will only save variables matching the pattern
      append              append config vars to the end of the file.
                          don't replace the old one.
      <var>=<value>       change the value of a config var
      add <var>=<value>   create a new config var
      get <var>           print the value of a config var
      delete <var>        deletes a config var
      clear               deletes all config vars
      =                   prompt for new value for each config var
      suffixes            Show suffix list according to priority
    NOTE: changes are not retained permanently unless saved

Further reading

bcmsh.md (published as https://kamelnetworks.github.io/sonic/bcmsh.html), SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), OpenBCM sdk-6.5.27/rc: rc.soc, config.bcm, td3_sanity.soc, cmd_td3_tr514_lr.soc, tr51/tr517_bcm56870_a0.soc, bcm_diag_info.soc …, sonic-mgmt test suite files invoking bcmcmd (19 files), broadcom-sonic-td3.config.bcm and common_config_readme, scripts/generate_dump (show techsupport collector), cPCI-6S10 Series 6U CompactPCI Switch Blade User’s Manual (50-15099-1000, Rev 1.0), Cisco Nexus 3000 Series NX-OS Programmability Guide, Release 9.2(x) – Packetized MMU Stats, Cisco Nexus 9000 Series NX-OS Programmability Guide, Release 7.x – Broadcom Shell, BCM-SDK命令的使用.pdf, BCM_SDK命令, bcm cmd.