TRUNK

Manage port aggregation

TRUNK

Manage trunks (link aggregation groups). SONiC’s PortChannels are trunks underneath. Sub-commands must be typed in full. The built-in help writes the options as <Id=val>, but they are ordinary Key=<value> options and can be abbreviated to their capital letters. trunk mcast takes Vlanid; the help’s Vlan= also works. A sub-command that takes options, run with no options, only prints the defaults.

show and hash get only read. Everything else changes trunk state that SONiC manages for its PortChannels, and SONiC is not told. Find the trunk IDs SONiC uses with trunk show and keep away from them; the examples below use trunk 10, which SONiC does not use on a small configuration, but the member ports are still SONiC’s ports.

Warning

trunk init and trunk deinit reset or tear down all trunks under SONiC. Every PortChannel stops working, and syncd may fail on its next PortChannel change.

trunk show [Id=<tid>]

Print how many trunk groups the chip supports (on Trident 3: 2048 front-panel trunks with up to 256 ports each, and 64 fabric trunks), and then each defined trunk with its member ports and its multicast and port-selection settings. Read-only.

On a SONiC switch each PortChannel is one trunk; in the example PortChannel2 (members xe0–xe2) is trunk 1. Trunk 0 is created by the SAI and has no ports. psc=portflow is the port-selection criterion SONiC’s PortChannels use.

Hardware-validated

drivshell> trunk show
Device supports 2112 trunk groups:
  2048 front panel trunks (0..2047), 256 ports/trunk
  64 fabric trunks (2048..2111), 64 ports/trunk
trunk 0: (front panel, 0 ports)
trunk 1: (front panel, 3 ports)=xe0,xe1,xe2 dlf=any mc=any ipmc=any psc=portflow (0x9)
trunk add Id=<tid> Rtag=<rtag> Pbmp=<pbmp>

Add ports to trunk Id, creating the trunk if needed. Rtag selects which packet fields choose the member port. Changes switch state.

Unvalidated

drivshell> trunk add Id=10 Rtag=3 Pbmp=xe3,xe4
trunk remove Id=<tid> Pbmp=<pbmp>

Remove ports from a trunk. Changes switch state.

Unvalidated

drivshell> trunk remove Id=10 Pbmp=xe4
trunk egress [Id=<tid>] Pbmp=<pbmp>

Limit which ports a trunk may send on. Changes switch state.

Unvalidated

drivshell> trunk egress Id=10 Pbmp=xe3
trunk mcast Id=<tid> Mac=<mac> Vlanid=<vid>

Join a multicast MAC address in a VLAN to a trunk. Changes switch state.

Unvalidated

drivshell> trunk mcast Id=10 Mac=01:00:5e:00:00:01 Vlanid=100
trunk hash <set | get> Pbmp=<pbmp> [HashValue=<n>]

get prints port <name> programmable hash set to <n> for each port. set writes the value. Trident 3 does not support the setting: get fails with TRUNK: ERROR: Feature unavailable.

Hardware-validated

drivshell> trunk hash get Pbmp=xe1
TRUNK: ERROR: Feature unavailable

Failed to execute the diagnostic command. Error: Operation failed.
trunk psc Id=<tid> Rtag=<rtag>

Change a trunk’s port-selection criterion. The help says “for testing ONLY”. A Cumulus release note shows the same form (Cumulus Linux 2.1 Release Notes, older chip). Changes switch state.

Unvalidated

drivshell> trunk psc Id=10 Rtag=3
trunk init

Initialise trunking; trunk deinit shuts it down. Both remove SONiC’s PortChannels from the hardware (see the warning above).

Unvalidated

drivshell> trunk init

Built-in help

Usages:
      trunk init
            - Initialize trunking function
      trunk deinit
            - Deinitialize trunking function
      trunk add <Id=val> <Rtag=val> <Pbmp=val>
            - Add ports to a trunk
      trunk remove <Id=val> <Pbmp=val>
            - Remove ports from a trunk
      trunk show [<Id=val>]
            - Display trunk information
      trunk egress [<Id=val>] <Pbmp=val>
            - Set egress ports for trunk
      trunk mcast <Id=val> <Mac=val> <Vlan=val>
            - Join multicast to a trunk
      trunk hash set <Pbmp=val> <HashValue=val>
            - Set ingress port hash value to select egress port of a trunk
      trunk hash get <Pbmp=val>
            - Get ingress port programmable hash value
      trunk psc <Id=val> <Rtag=val>
            - Change Rtag (for testing ONLY)

Further reading

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 …, Cisco Nexus 9000 Series NX-OS Troubleshooting Guide, Release 9.3(x) – Troubleshooting VLANs, H3C S12500-F系列交换机 Probe命令参考(R100x系列)-6W100, BISDN Linux bundle-debug-info support script, Cumulus Linux 2.1 Release Notes, FBOSS: BcmSwitch gatherSdkState/rcload, validated shell commands, diag shell stress test, vendor-diag-shell skill, debugging doc, BCM_SDK命令, 交换芯片Helix4 L2 L3功能验证.