Skip to content

Commit

Permalink
Update lag_test_plan.md
Browse files Browse the repository at this point in the history
Signed-off-by: richardyu-ms <[email protected]>
  • Loading branch information
zhoudongxu authored and richardyu-ms committed May 24, 2022
1 parent 0b2cf17 commit d733bd4
Showing 1 changed file with 47 additions and 15 deletions.
62 changes: 47 additions & 15 deletions doc/sai-ptf/lag_test_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Test suites](#test-suites)
- [Test suite #1: PortChannel Loadbalanceing](#test-suite-1-portchannel-loadbalanceing)
- [Test suite #2: Ingress/Egreee disable](#test-suite-2-ingressegreee-disable)
- [Test suite #3: Remove Lag member](#test-suite-3-remove-lag-member)
## Overriew
The purpose of this test plan is to test the LAG/PortChannel function from SAI.

Expand All @@ -35,7 +36,7 @@ The test will include two parts

## APIs

Create and lag member
Create lag and lag member
```Python
sai_thrift_create_lag(self.client)
sai_thrift_create_lag_member(
Expand All @@ -60,7 +61,6 @@ counter_results["SAI_PORT_STAT_IF_OUT_UCAST_PKTS"]))
```

Add fdb entry
**P.s.For fordwarding packet with vlan tag, fdb entry should enable the bv_id**
```python
sai_thrift_fdb_entry_t(switch_id=self.switch_id, mac_address=mac1, bv_id=self.vlan_oid)
sai_thrift_create_fdb_entry(
Expand Down Expand Up @@ -102,16 +102,18 @@ sai_thrift_set_lag_member_attribute(
egress_disable=True)
```

| Steps/Cases | Goal | Expect |
| Goal| Steps/Cases | Expect |
|-|-|-|
| Create lag, add lag members, port1 - 4. Add FDB entry for lag, map with a MAC. | Create lag and member| lag, and member created|
| Send packet with.| Prepare to send from lag to VLAN.| Vlan and members have been created.|
| Send packet on port0 to the lag by specifying lag mac as dest mac. 4 times .| Packet forwards on port equally.| Loadbalance on lag members.|
| Every time, disable egress/ingress on one lag member, then send packet | Packet forwards on available ports equally.| Loadbalance on lag members.|
| Every time, enable egress/ingress on one lag member, then send packet | Packet forwards on available ports equally.| Loadbalance on lag members.|
| Every time, remove one lag member, then send packet | Packet forwards on available ports equally.| Loadbalance on lag members.|
| Create lag and member| Create lag, add lag members, port1 - 4. Add FDB entry for lag, map with a MAC. | lag, and member created|
| Prepare to send from lag to VLAN.| Send packet with.| Vlan and members have been created.|
| Packet forwards on port equally.| Send packet on port0 to the lag by specifying lag mac as dest mac. 4 times .| Loadbalance on lag members.|
| Packet forwards on available ports equally.| Every time, disable egress/ingress on one lag member, then send packet | Loadbalance on lag members.|
| Packet forwards on available ports equally.| Every time, enable egress/ingress on one lag member, then send packet | Loadbalance on lag members.|
| Packet forwards on available ports equally.| Every time, remove one lag member, then send packet | Loadbalance on lag members.|

## Test suite #2: Ingress/Egreee disable
For lag, we can disable it from ingress or egress direction, after we disable the member of a lag, we expect traffic can be loadbalanced to other lag members.

Sample APIs

Ingress/Egreee disable
Expand All @@ -130,11 +132,41 @@ sai_thrift_get_lag_attribute(
self.client, self.lag1, port_list=portlist)
```

| Steps/Cases | Goal | Expect |
| Goal | Steps/Cases | Expect |
|-|-|-|
| Add FDB entry for port4 map to a MAC. Create lag and add port4 as a member. | Create lag and member| lag, and member created|
| Create VLAN and add VLAN member with port0 and port1.| Prepare to send from lag to VLAN.| Vlan and members have been created.|
| Send packet on port1 with target mac on port4. | Forwarding from port1 to port4.| Receive packet on port4.|
| Disable egress and ingress on lag member4. send packet | Packet dropped on port4| Packet drop.|
| Enable lag egress and ingress. Send packet with VLAN tag on lag port4 with a new dest mac.|Packet flooding on VLAN members, port0 and port1.|Packet received.|
| Create lag and member| Add FDB entry for port4 map to a MAC. Create lag and add port4 as a member. | lag, and member created|
| Prepare to send from lag to VLAN.| Create VLAN and add VLAN member with port0 and port1.| Vlan and members have been created.|
| Forwarding from port1 to port4.| Send packet on port1 with target mac on port4. | Receive packet on port4.|
|Packet dropped on port4| Disable egress and ingress on lag member4. send packet | Packet drop.|
|Packet flooding on VLAN members, port0 and port1.| Enable lag egress and ingress. Send packet with VLAN tag on lag port4 with a new dest mac.|Packet received.|

## Test suite #3: Remove Lag member
Sample APIs
create packet
```python
simple_tcp_packet(eth_dst='00:11:11:11:11:11',
eth_src='00:22:22:22:22:22',
ip_dst=dst_ip_addr,
ip_src='192.168.8.1',
ip_id=109,
ip_ttl=64)
```
Remove Lag member
```python
print("Remove LAG member 4")
status = sai_thrift_remove_lag_member(self.client, self.lag1_member4)

```
How to check if each port of Lag receive an equal number of packets (if we have n members in a Lag),
```python
self.max_itrs =100
for i in range(0, n):
self.assertTrue((count[i] >= ((self.max_itrs / n) * 0.7)),

```
| Goal | Steps/Cases | Expect |
|-|-|-|
|1.Create lag and member|Create lag1 and add port4,port5,port6 as member.| lag, and member created|
|2.Forwarding packet from port1 to any port of lag1.|Send packet on port1 to lag1 100 times.|Each port of lag1 receive an equal number of packets.|
|3.Remove port6 and forwarding packet from port1 to port4,5|Remove port6 form Lag1 and do step2 again| Port4 and port5 will receive an equal number of packets.|
|4. Remove port5 from Lag1, do step3 again|

0 comments on commit d733bd4

Please sign in to comment.