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 27, 2022
1 parent 93a6b66 commit e491548
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 168 deletions.
70 changes: 29 additions & 41 deletions doc/sai-ptf/lag_test_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
- [Packets](#packets)
- [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)
- [Test suite #2: Remove Lag member](#test-suite-2-remove-lag-member)
- [Test suite #3: Ingress/Egreee disable](#test-suite-3-ingressegreee-disable)
## Overriew
The purpose of this test plan is to test the LAG/PortChannel function from SAI.

Expand Down Expand Up @@ -109,14 +109,17 @@ For load balancing, expecting the ports in a lag should receive the packet equal

Even after removing and disabling the port in a lag.

Sample APIS
Disbale egress
```Python
sai_thrift_set_lag_member_attribute(
self.client,
self.lag3_member14,
ingress_disable=True,
egress_disable=True)
Sample SAI API
```python

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

#Send packet from dev_port11
send_packet(self, self.dev_port11, pkt)

```

| Goal| Steps/Cases | Expect |
Expand All @@ -127,50 +130,35 @@ sai_thrift_set_lag_member_attribute(
| 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.
## Test suite #2: Remove Lag member
Test verifies the LAG load balancing for scenario when LAG members are removed.

Sample APIs

Ingress/Egreee disable
Remove Lag member
```python
status = sai_thrift_set_lag_member_attribute(
self.client,
self.lag3_member14,
ingress_disable=True,
egress_disable=True)

```

lag port list
```Python
sai_thrift_get_lag_attribute(
self.client, self.lag3, port_list=portlist)
print("Remove LAG member 16")
status = sai_thrift_remove_lag_member(self.client, self.lag3_member16)
```

| Goal | Steps/Cases | Expect |
|-|-|-|
|Packet dropped on port14| Disable egress and ingress on lag member14. send packet | Packet drop.|
|Remove port16 and forwarding packet from port1 to port14,15|Remove port16 form Lag3 and Send packet on dev_port11 to lag3 100 times| Port14 and port15 will receive an equal number of packets.|

## Test suite #3: Remove Lag member
Test verifies the LAG load balancing for scenario when LAG members are removed.

Sample APIs
## Test suite #3: 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.

Remove Lag member
```python
print("Remove LAG member 16")
status = sai_thrift_remove_lag_member(self.client, self.lag3_member16)
Sample APIs

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

```
| Goal | Steps/Cases | Expect |
|-|-|-|
|Remove port16 and forwarding packet from port1 to port14,15|Remove port16 form Lag3 and Send packet on dev_port11 to lag3 100 times| Port14 and port15 will receive an equal number of packets.|

|Packet dropped on port14| Disable egress and ingress on lag member14. send packet | Packet drop.|
26 changes: 26 additions & 0 deletions doc/sai-ptf/pcbb_test_plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Overriew
The purpose of this test plan is to test the tunnel PFC function from SAI.

### Test Topology
For SAI-PTF, it will use a non-topology network structure for the sai testing.

### Testbed
Those tests will be run on the testbed structure, the components are:
* PTF - running in a server that can connect to the target DUT
* SAI server - running on a dut

*p.s. cause the SAI testing will not depend on any sonic components, then there will be no specific topology(T0 T1 T2) for testing.*

## Scope
The test will include two parts
1. Tunnel


## Test Suites
*p.s. We can extend this test to each port with a loop, just take smaple amount of ports as example.*


### Test suite #1 : IPinIP Tunnel

#### Testing Objective
check the ip in ip tunnel can create successful and check the packet.
129 changes: 2 additions & 127 deletions doc/sai-ptf/vlan_test_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
- [VLAN interface input packet](#vlan-interface-input-packet)
- [VLAN interface output packet](#vlan-interface-output-packet)
- [Test case](#test-case)
- [Test Case: VLAN interface (RIF/SVI)](#test-case-vlan-interface-rifsvi-1)
- [Route entry](#route-entry-1)
- [VLAN interface to Port](#vlan-interface-to-port)
- [Test suite: Tagging and trunk/access](#test-suite-tagging-and-trunkaccess)
- [Test suite: Untagging and access](#test-suite-untagging-and-access)
- [Composit scenario: ARP Flooding and learn](#composit-scenario-arp-flooding-and-learn)
- [Test case: Test Frame Filtering](#test-case-test-frame-filtering)
- [SAI APIs operations](#sai-apis-operations)
Expand Down Expand Up @@ -237,127 +234,7 @@ Vlan to Port:
| Forwarding packet on ``VLAN_INTERFACE`` .| Send ``Untagged`` packet with dest ``SVI_MAC`` on port1. | ``Untagged`` packet received on ``PORT15``.|




### Test Case: VLAN interface (RIF/SVI)
**Testing Objective**

Test the configuration as below

```xml
<DeviceL3Info Hostname="AMS08-0101-0522-08T0">
<VlanInterface Name="s1h" AttachTo="Ethernet6/1;Ethernet7/1;Ethernet8/1" vlanid="608" tag="608" Subnets="10.95.88.208/28" Type="AzureCompute" />
<IPInterface AttachTo="s1h" Prefix="10.95.88.209/28" />
<IPInterface AttachTo="s1h" Prefix="2603:10a0:31c:8144::1/64" />
</DeviceL3Info>
```
Convert to config_db.json
```json
"VLAN": {
"Vlan608": {
"members": [
"Ethernet6/1",
"Ethernet7/1",
"Ethernet8/1",
],
"vlanid": "608"
}
},
"VLAN_INTERFACE": {
"Vlan608": {},
"Vlan608|10.95.88.209/28": {},
"Vlan608|2603:10a0:31c:8144::1/64": {}
},
"VLAN_MEMBER": {
"Vlan608|Ethernet6/1": {
"tagging_mode": "untagged"
},
"Vlan608|Ethernet7/1": {
"tagging_mode": "untagged"
},

"Vlan608|Ethernet8/1": {
"tagging_mode": "untagged"
},
}
```

**Testing Description**

When a switch needs to forward in layer3, it needs a VLAN interface in layer3(SVI) for packet routing or Trunk connection to other devices/servers.
```
Test example:
Vlan to Port:
pkt(Untag) -> |DUT|Port3(VLAN10:Trunk) -> RIF(VLAN_IF->MAC:IP1) ||| vlan100 || -> Port(Access) -> ...
```

Need the APIs as below

- Create Router for a VLAN interface (not used in currernt test, just for explain the route creation.)
```Python
self.vlan100_rif = sai_thrift_create_router_interface(
self.client,
type=SAI_ROUTER_INTERFACE_TYPE_VLAN,
virtual_router_id=self.default_vrf,
vlan_id=self.vlan100)

self.nhop1 = sai_thrift_create_next_hop(
self.client,
ip=sai_ipaddress(next_hop_ip), #SVI_IP
router_interface_id=self.vlan100_rif,
type=SAI_NEXT_HOP_TYPE_IP)
self.neighbor_entry1 = sai_thrift_neighbor_entry_t(
rif_id=self.vlan100_rif,
ip_address=sai_ipaddress(next_hop_ip))#SVI_IP
#Nhop to vlan interface
sai_thrift_create_neighbor_entry(
self.client, self.neighbor_entry1,
dst_mac_address=self.portmac) #Dest port mac, i.e port15:mac15 in vlan100
#Route to vlan interface
self.route_entry1 = sai_thrift_route_entry_t(
vr_id=self.default_vrf,
destination=sai_ipprefix(pkt_dest_ip+'/32')) # Packet dest IP
sai_thrift_create_route_entry(
self.client, self.route_entry1, next_hop_id=self.nhop1)
```

#### Route entry
|DestIp|Next Hop |Next Hop ip|Next Hop Mac|
|-|-|-|-|
|10.10.0.1|vlanInterface(VLAN100)|10.10.10.10(SVI_IP)|PORTMAC|

#### VLAN interface to Port
VLAN interface input packet
```Python
simple_tcp_packet(
eth_dst=SVI_MAC, #Forwarding in vlan
eth_src=SRC_MAC,
ip_dst=DEST_IP,
ip_src=SRC_IP)
```

VLAN interface output packet
```Python
simple_tcp_packet(
eth_dst=PORT_MAC,
eth_src=SVI_MAC, #Switch MAC
ip_dst=DEST_IP,
ip_src=SRC_IP)
```

**Precondition/Setup:**
- Create VLAN as the basic configuration.
- Create an FDB table as a basic configuration.
- Create VLAN Interface for ``VLAN100`` with ``SVI_IP``
- Create route DESTIP:IP1 to ``PORT15``

Below is the test for checking this.
| Goal |Steps/Cases | Expect |
|-|-|-|
| Forwarding packet on ``VLAN_INTERFACE`` .| Send ``Untagged`` packet with dest ``SVI_MAC`` on port1. | ``Untagged`` packet received on ``PORT15``.|


### Test suite: Tagging and trunk/access
### Test suite: Untagging and access

This is a basic funcation testing. This test suite will cover the basic VLAN function around untag and access port.

Expand Down Expand Up @@ -548,8 +425,6 @@ sai_thrift_clear_vlan_stats(self.client, self.vlan10)
Precondition/Setup:
- Create VLAN as the basic configuration.
- Create an FDB table as a basic configuration.
- Create VLAN Interface for ``VLAN10`` with ``IP1``
- Create route DESTIP:IP1 to ``PORT20``

| Goal |Steps/Cases | Expect |
|-|-|-|
Expand Down

0 comments on commit e491548

Please sign in to comment.