|
| 1 | +# W-ECMP Test Plan |
| 2 | + |
| 3 | +## Related documents |
| 4 | + |
| 5 | +| **Document Name** | **Link** | |
| 6 | +|-------------------|----------| |
| 7 | +| SONiC Weighted ECMP | [https://github.com/sonic-net/SONiC/blob/master/doc/wcmp/wcmp-design.md]| |
| 8 | + |
| 9 | +## Overview |
| 10 | +In ECMP (Equal-Cost Multi-Path) scenario, traffic is distributed equally across all available paths and each path has same cost. |
| 11 | + |
| 12 | +In W-ECMP (Weighted-Cost Multi-Path) scenario, it can distribute traffic base on the weight value assigned to each path. This is useful when the paths have different bandwidth capacities. In a W-ECMP setup, each path is assigned a weight based on various criteria, such as bandwidth, delay, or administrative preferences. BGP then uses these weights to distribute outbound traffic among the multiple available paths |
| 13 | + |
| 14 | + |
| 15 | +## BGP link bandwidth extended community |
| 16 | +The BGP link bandwidth extended community contains information about the bandwidth of a link. This information is advertised along with BGP route updates to inform other routers about the capacity of the link. |
| 17 | +RFC: [https://datatracker.ietf.org/doc/html/draft-ietf-idr-link-bandwidth] |
| 18 | + |
| 19 | +``` |
| 20 | +router bgp 65200 |
| 21 | + bgp router-id 10.1.0.2 |
| 22 | + no bgp ebgp-requires-policy |
| 23 | + neighbor SPINE1 peer-group |
| 24 | + neighbor SPINE1 remote-as 65100 |
| 25 | + neighbor 10.10.1.1 peer-group SPINE1 |
| 26 | + neighbor 10.10.2.1 peer-group SPINE1 |
| 27 | + ! |
| 28 | + address-family ipv4 unicast |
| 29 | + network 20.20.20.0/24 |
| 30 | + neighbor SPINE1 route-map TO_BGP_PEER_V4 out <<<<<< |
| 31 | + exit-address-family |
| 32 | +exit |
| 33 | +! |
| 34 | +route-map TO_BGP_PEER_V4 permit 100 |
| 35 | + set extcommunity bandwidth num-multipaths <<<<<< |
| 36 | +exit |
| 37 | +! |
| 38 | +route-map TO_BGP_PEER_V6 permit 100 |
| 39 | + set extcommunity bandwidth num-multipaths |
| 40 | +exit |
| 41 | +``` |
| 42 | + |
| 43 | +### Disable W-ECMP |
| 44 | +If W-ECMP is `disabled`, the BGP update message contains three default path attributes `ORIGIN`/`AS_PATH`/`NEXT_HOP` when advertising network prefix 10.0.0.0/24 |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +### Enable W-ECMP |
| 49 | +If W-ECMP is `enabled`, the BGP `EXTENDED_COMMUNITIES` attribute is added in the update message (yellow part) |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +## Related DUT CLI commands |
| 54 | + |
| 55 | +### Config |
| 56 | +The following command can be used to enable/disable W-ECMP: |
| 57 | +``` |
| 58 | +config bgp device-global wcmp enabled |
| 59 | +config bgp device-global wcmp disabled |
| 60 | +``` |
| 61 | + |
| 62 | +### Show |
| 63 | +The following command can be used to show W-ECMP status: |
| 64 | +``` |
| 65 | +show bgp device-global |
| 66 | +show bgp device-global --json |
| 67 | +``` |
| 68 | +Example: |
| 69 | +``` |
| 70 | +admin@router:~$ show bgp device-global |
| 71 | +TSA WCMP |
| 72 | +-------- ------- |
| 73 | +disabled enabled |
| 74 | +``` |
| 75 | +``` |
| 76 | +admin@router:~$ show bgp device-global --json |
| 77 | +{ |
| 78 | + "tsa": "disabled", |
| 79 | + "wcmp": "enabled" |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | +## Related DUT configuration files |
| 85 | +``` |
| 86 | +"BGP_DEVICE_GLOBAL": { |
| 87 | + "STATE": { |
| 88 | + "tsa_enabled": "false", |
| 89 | + "wcmp_enabled": "true" |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | + |
| 95 | +## Testbed |
| 96 | + |
| 97 | +We can use BGP VRF to split the DUT host into DUT1 and DUT2 |
| 98 | + |
| 99 | +1. BGP neighbor relationship |
| 100 | +- DUT1 establish BGP neighbor with SPINE1 and SPINE2, each neighbor has two BGP sessions |
| 101 | +- DUT2 establish BGP neighbor with SPINE1 and SPINE2, each neighbor has two BGP sessions |
| 102 | + |
| 103 | +2. BGP route advertise |
| 104 | +- DUT2 advertises ip prefix 100.0.0.1/32 to SPINE1, then SPINE1 advertises it to DUT1 |
| 105 | +- DUT2 advertises ip prefix 100.0.0.1/32 to SPINE2, then SPINE2 advertises it to DUT1 |
| 106 | + |
| 107 | +Finally, DUT1 has four route to the destination 100.0.0.1 |
| 108 | +``` |
| 109 | +admin@router:~$ ip route show 100.0.0.1 |
| 110 | +100.0.0.1 proto bgp metric 20 |
| 111 | + nexthop via 10.10.26.1 dev Ethernet100 weight 1 |
| 112 | + nexthop via 10.10.27.1 dev Ethernet104 weight 1 |
| 113 | + nexthop via 10.10.28.1 dev Ethernet108 weight 1 |
| 114 | + nexthop via 10.10.29.1 dev Ethernet112 weight 1 |
| 115 | +``` |
| 116 | + |
| 117 | + |
| 118 | +## Test cases |
| 119 | +### Test case #1 - W-ECMP command line test |
| 120 | +1. Enable W-ECMP and verify W-ECMP status on DUT2 |
| 121 | +``` |
| 122 | +admin@router:~$ sudo config bgp device-global wcmp enabled |
| 123 | +admin@router:~$ show bgp device-global |
| 124 | +TSA WCMP |
| 125 | +-------- ------- |
| 126 | +disabled enabled |
| 127 | +``` |
| 128 | +2. Verify the route weight value on DUT1 is 25, which means W-ECMP is effect |
| 129 | +``` |
| 130 | +admin@router:~$ ip route show 100.0.0.1 |
| 131 | +100.0.0.1 proto bgp metric 20 |
| 132 | + nexthop via 10.10.26.1 dev Ethernet100 weight 25 |
| 133 | + nexthop via 10.10.27.1 dev Ethernet104 weight 25 |
| 134 | + nexthop via 10.10.28.1 dev Ethernet108 weight 25 |
| 135 | + nexthop via 10.10.29.1 dev Ethernet112 weight 25 |
| 136 | +``` |
| 137 | +3. Disable W-ECMP and verify W-ECMP status on DUT2 |
| 138 | +``` |
| 139 | +admin@router:~$ sudo config bgp device-global wcmp disabled |
| 140 | +admin@router:~$ show bgp device-global |
| 141 | +TSA WCMP |
| 142 | +-------- ------- |
| 143 | +disabled disabled |
| 144 | +``` |
| 145 | +4. Verify the route weight value on DUT1 is 1, which means W-ECMP is disabled |
| 146 | +``` |
| 147 | +admin@router:~$ ip route show 100.0.0.1 |
| 148 | +100.0.0.1 proto bgp metric 20 |
| 149 | + nexthop via 10.10.26.1 dev Ethernet100 weight 1 |
| 150 | + nexthop via 10.10.27.1 dev Ethernet104 weight 1 |
| 151 | + nexthop via 10.10.28.1 dev Ethernet108 weight 1 |
| 152 | + nexthop via 10.10.29.1 dev Ethernet112 weight 1 |
| 153 | +``` |
| 154 | + |
| 155 | + |
| 156 | +### Test case #2 - Verify W-ECMP behavior when no link failure |
| 157 | +1. Enable W-ECMP and verify W-ECMP status on DUT2 |
| 158 | +``` |
| 159 | +admin@router:~$ sudo config bgp device-global wcmp enabled |
| 160 | +``` |
| 161 | +2. Verify the route weight value on DUT1 is 25, which means W-ECMP take effective |
| 162 | +``` |
| 163 | +admin@router:~$ ip route show 100.0.0.1 |
| 164 | +100.0.0.1 proto bgp metric 20 |
| 165 | + nexthop via 10.10.26.1 dev Ethernet100 weight 25 |
| 166 | + nexthop via 10.10.27.1 dev Ethernet104 weight 25 |
| 167 | + nexthop via 10.10.28.1 dev Ethernet108 weight 25 |
| 168 | + nexthop via 10.10.29.1 dev Ethernet112 weight 25 |
| 169 | +``` |
| 170 | +3. DUT1 sends traffic to destination 100.0.0.1 |
| 171 | +4. Verify that traffic throughput on each nexthop is the same |
| 172 | + |
| 173 | + |
| 174 | +### Test case #3 - Verify W-ECMP behavior after link failure |
| 175 | +1. Enable W-ECMP and verify W-ECMP status on DUT2 |
| 176 | +``` |
| 177 | +admin@router:~$ sudo config bgp device-global wcmp enabled |
| 178 | +``` |
| 179 | +2. Verify the route weight value on DUT1 is 25, which means W-ECMP take effective |
| 180 | +``` |
| 181 | +admin@router:~$ ip route show 100.0.0.1 |
| 182 | +100.0.0.1 proto bgp metric 20 |
| 183 | + nexthop via 10.10.26.1 dev Ethernet100 weight 25 |
| 184 | + nexthop via 10.10.27.1 dev Ethernet104 weight 25 |
| 185 | + nexthop via 10.10.28.1 dev Ethernet108 weight 25 |
| 186 | + nexthop via 10.10.29.1 dev Ethernet112 weight 25 |
| 187 | +``` |
| 188 | +3. Shutdown one link between DUT2 and SPINE2 |
| 189 | +4. Verify the weight value on DUT1 has updated after link failure |
| 190 | +``` |
| 191 | +admin@router:~$ ip route show 100.0.0.1 |
| 192 | +100.0.0.1 proto bgp metric 20 |
| 193 | + nexthop via 10.10.26.1 dev Ethernet100 weight 16 |
| 194 | + nexthop via 10.10.27.1 dev Ethernet104 weight 16 |
| 195 | + nexthop via 10.10.28.1 dev Ethernet108 weight 33 |
| 196 | + nexthop via 10.10.29.1 dev Ethernet112 weight 33 |
| 197 | +``` |
| 198 | +5. DUT1 sends traffic to destination 100.0.0.1 |
| 199 | +6. Verify that traffic throughput on each nexthop is based on weight value of the interface |
| 200 | +7. Recover the failed link between DUT and SPINE1 |
| 201 | +8. Verify the route weight value on DUT1 is 25 |
| 202 | + |
| 203 | + |
| 204 | +### Test case #4 - Verify configuration persists after warm/cold/fast reboot |
| 205 | +1. Enable W-ECMP on DUT, verify the config take effective on DUT2 |
| 206 | +2. DUT2 warm/cold/fast reboot |
| 207 | +3. Verify W-ECMP configuration persist after reboot |
| 208 | +4. Traffic test, verify the W-ECMP function still take effect |
| 209 | + |
| 210 | + |
| 211 | +### Test case #5 - Verify interface flap |
| 212 | +1. Enable W-ECMP on DUT2 |
| 213 | +2. The interface between DUT2 and SPINE2 flaps 10 times, it will trigger weight recalculation and prefix installation |
| 214 | +3. Verify the W-ECMP function still take effect and no dump generate |
| 215 | + |
| 216 | + |
| 217 | +### Test case #6 - Verify W-ECMP feature status flap |
| 218 | +1. Enable/disable W-ECMP feature 10 times on DUT2 |
| 219 | +2. Verify the W-ECMP function still take effect and no dump generate |
0 commit comments