Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VLAN and PortChannel test plan #1480

Merged
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions doc/sai-ptf/config_data/config_t0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Sample T0 Configurations and data <!-- omit in toc -->
- [Overriew](#overriew)
- [IP and MAC naming convention](#ip-and-mac-naming-convention)
- [MAC](#mac)
- [IP](#ip)
- [1. L2 Configurations](#1-l2-configurations)
- [1.1 FDB Configuration](#11-fdb-configuration)
- [1.2 VLAN configuration](#12-vlan-configuration)
- [2. L3 configuration](#2-l3-configuration)
- [2.1 VLAN Interfaces](#21-vlan-interfaces)
- [2.2 LAG configuration](#22-lag-configuration)
- [2.2.1 LAG Hash Rule](#221-lag-hash-rule)
- [2.3 Route Configuration](#23-route-configuration)
- [2.3.1 VLAN interfaces route entries](#231-vlan-interfaces-route-entries)
- [2.3.2 LAG Route entry](#232-lag-route-entry)
- [2.4 Neighbor Configuration](#24-neighbor-configuration)
- [2.4.1 VLAN Neighbors](#241-vlan-neighbors)
- [2.4.2 LAG Neighbors](#242-lag-neighbors)
# Overriew
This document describes the sample configuration data.

**Note: This configuration focused on T0 topology.**

# IP and MAC naming convention
In this configuration, we mapped the IP and MAC address into different parts of this configuration as below.

## MAC
For MAC addresses, we can use different sections in the MAC addresses to map different title numbers.
The pattern is
```
L1_NUM:L2_NUM:L3_NUM:ROLE:EXTRA:SEQ
richardyu-ms marked this conversation as resolved.
Show resolved Hide resolved
ROLE: T1=1, Server=99
```

For example:
For the MAC address in ``1.1 FDB Configuration``.
```
#Server MAC
01:01:00:99:02:01~01:01:00:99:02:32
# 99: Server
# 02: EXTRA (Group ID)
```


## IP
For IP addresses, we will use different prefix for different role

Format: ROLE.NUM.GROUP_ID.SEQ

- ROLE_NUM
T0: 10.0.0.0
T1: 10.0.0.0
Server: 192.168.0.0

For example
```
# IP in
# 2.4.1 VLAN Neighbors
#Group0 (For Vlan10)
192.168.1.1~ 192.168.1.8
#Group1 (ForVlan20)
192.168.2.1~ 192.168.2.8
```




# 1. L2 Configurations

## 1.1 FDB Configuration

The MAC Table for VLAN L2 forwarding as below
|Name|MAC|PORT|VLAN|HostIf|
|-|-|-|-|-|
|mac0|01:01:00:99:00:00|Port0||Ethernet0|
|mac1-8 |01:01:00:99:01:01 - 01:01:00:99:01:08|Port1-8|10|Ethernet4-Ethernet32|
|mac9-16 |01:01:00:99:02:09 - 01:01:00:99:02:16|Port9-16|20|Ethernet36-Ethernet64|

## 1.2 VLAN configuration

|HostIf|VLAN ID|Ports|Tag mode|
|-|-|-|-|
|Ethernet4-32|10|Port1-8|Untag|
|Ethernet36-72|20|Port9-16|Untag|


# 2. L3 configuration

Host interface IP
|Port|Interface IP|
|-|-|
|port0|10.0.0.100|

## 2.1 VLAN Interfaces
|VLAN ID | VLAN Interface IP|
|-|-|
|10|192.168.1.100|
|20|192.168.2.100|

## 2.2 LAG configuration

|HostIf|LAG ID|Ports|
|-|-|-|
|Ethernet76-80|lag1|Port17-18|
|Ethernet84-88|lag2|Port19-20|

### 2.2.1 LAG Hash Rule
- Set hash algorithm as SAI_HASH_ALGORITHM_CRC
- Set switch hash attribute as below, which means switch computes hash using the five fields and seed(SAI_SWITCH_ATTR_LAG_DEFAULT_HASH_SEED) as the hash configuration.
```
richardyu-ms marked this conversation as resolved.
Show resolved Hide resolved
SAI_NATIVE_HASH_FIELD_SRC_IP
SAI_NATIVE_HASH_FIELD_DST_IP
SAI_NATIVE_HASH_FIELD_IP_PROTOCOL
SAI_NATIVE_HASH_FIELD_L4_DST_PORT
SAI_NATIVE_HASH_FIELD_L4_SRC_PORT
```

## 2.3 Route Configuration

### 2.3.1 VLAN interfaces route entries
|VLAN ID | route IP | Type |
|-|-| - |
|10| 192.168.1.100/24 | Direct Connect|
|20| 192.168.2.100/24 | Direct Connect|
### 2.3.2 LAG Route entry

|LAG ID | route IP | Type | VALUE|
|-|-| - |-|
|1| 10.0.1.100/31 | Direct Connect||
|2| 10.0.2.100/31 | Direct Connect||
|1| 192.168.10.1-192.168.10.100| NH|lag1_nb|
|2| 192.168.11.1-192.168.11.100| NH|lag2_nb|

## 2.4 Neighbor Configuration
### 2.4.1 VLAN Neighbors
|Name|Port|IP|dest_mac|
|-|-|-|-|
|vlan10_nb1-nb8|Port1-8 |192.168.1.1 ~ 192.168.1.8 |01:01:00:99:01:01 - 01:01:00:99:01:08|
|vlan20_nb1-nb8|Port9-16|192.168.2.9 ~ 192.168.2.16 |01:01:00:99:02:09 - 01:01:00:99:02:16 |


### 2.4.2 LAG Neighbors

|Name|Port|IP|dest_mac|
|-|-|-|-|
|lag1_nb|lag1| 10.0.1.101 | 02:04:02:01:01:01|
|lag2_nb|lag2| 10.0.2.101 | 02:04:02:01:02:01|
155 changes: 155 additions & 0 deletions doc/sai-ptf/lag_test_plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# SAI LAG Test plan
- [SAI LAG Test plan](#sai-lag-test-plan)
- [Overriew](#overriew)
- [Test Configuration](#test-configuration)
- [Test Execution](#test-execution)
- [Test Data/Packet](#test-datapacket)
- [Test Group1: L3 PortChannel Load balancing](#test-group1-l3-portchannel-load-balancing)
- [Case1: test_loadbalance_on_source_port](#case1-test_loadbalance_on_source_port)
- [Case2: test_loadbalance_on_destinstion_port](#case2-test_loadbalance_on_destinstion_port)
- [Case3: test_loadbalance_on_source_ip](#case3-test_loadbalance_on_source_ip)
- [Case4: test_loadbalance_on_destinstion_ip](#case4-test_loadbalance_on_destinstion_ip)
- [Case5: test_loadbalance_on_protocol](#case5-test_loadbalance_on_protocol)
- [Test Group2: Disable Egress/Ingress](#test-group2-disable-egressingress)
- [Case6: test_disable_egress](#case6-test_disable_egress)
- [Case7: test_disable_ingress](#case7-test_disable_ingress)
- [Test Group3: Remove/Add LAG member](#test-group3-removeadd-lag-member)
- [Case8: test_remove_lag_member](#case8-test_remove_lag_member)
- [Case9: test_add_lag_member](#case9-test_add_lag_member)
- [Test Group4: Indifference Ingress Port in Hash](#test-group4-indifference-ingress-port-in-hash)
- [Case10: test_ingress_port_hash_indiff](#case10-test_ingress_port_hash_indiff)
- [Test Objective](#test-objective)
# Overriew
The purpose of this test plan is to test the LAG/PortChannel function from SAI.


# Test Configuration

For the test configuration, please refer to LAG configuration section of the file
- [Config_t0](./config_data/config_t0.md)

**Note. All the tests will be based on the configuration above, if any additional configuration is required, it will be specified in the Test case.**

# Test Execution
## Test Data/Packet
```Python
pkt = simple_udp_packet(eth_dst=ROUTER_MAC,
eth_src=src_mac,
ip_dst=dst_ip_addr,
ip_src=src_ip_addr,
udp_sport=udp_sport,
udp_dport=udp_dport,
ip_id=106,
ip_ttl=64)

exp_pkt = simple_udp_packet(eth_dst=dstmac,
eth_src=ROUTER_MAC,
ip_dst=dst_ip_addr,
ip_src=src_ip_addr,
udp_sport=udp_sport,
udp_dport=udp_dport,
ip_id=106,
ip_ttl=63)
```

```Python
pkt = simple_tcp_packet(eth_dst=ROUTER_MAC,
eth_src=src_mac,
ip_dst=dst_ip_addr,
ip_src=src_ip_addr,
tcp_sport=tcp_sport,
tcpp_dport=tcp_dport,
ip_id=106,
ip_ttl=64)

exp_pkt = simple_udp_packet(eth_dst=dstmac,
eth_src=ROUTER_MAC,
ip_dst=dst_ip_addr,
ip_src=src_ip_addr,
tcp_sport=tcp_sport,
tcp_dport=tcp_dport,
ip_id=106,
ip_ttl=63)
```
## Test Group1: L3 PortChannel Load balancing
These cases will cover five scenarios: src/dst IP, src/dst port, and protocol. considering the mighty hash collision, please make sure the volume of the test data, and we can check the final result is in a range.


### Case1: test_loadbalance_on_source_port
### Case2: test_loadbalance_on_destinstion_port
### Case3: test_loadbalance_on_source_ip
### Case4: test_loadbalance_on_destinstion_ip
### Case5: test_loadbalance_on_protocol


### Testing Objective <!-- omit in toc -->
For load balancing, expecting the ports in a lag should receive the packet equally. Traffic direction: from server-side to T1 side.

### Test steps: <!-- omit in toc -->
1. Generate different packets by updating different factors for each case. The factor includes source port(L4), destination port(L4), source IP, and destination IP of the packet. Packets use lag1 neighbor IPs as destination IP, and lag1 MAC (Switch MAC) as destination MAC.
2. Send these packets with different protocols on port1(with different cases).
3. Check if packets are received on ports of lag1 equally.

## Test Group2: Disable Egress/Ingress


### Case6: test_disable_egress
### Case7: test_disable_ingress

### Testing Objective <!-- omit in toc -->
These cases will cover two scenarios: disable egress and ingress. We can disable ingress or egress on a lag member, then we expect traffic drop on the disabled lag member.

### Test steps: <!-- omit in toc -->
- test_disable_egress

1. Generate different packets by updating different factors for each case. The factor includes source port(L4), destination port(L4), source IP, and destination IP of the packet. Packets use lag1 neighbor IPs as destination IP, and lag1 MAC (Switch MAC) as destination MAC.
2. Send packet from port1
3. Verify packets appear on different lag1 members(Baseline check).
4. Disable egress on lag1 member port18
5. Send packets in step1 from port1 again
6. Check if the Packet drop on port18

- test_disable_ingress

1. Generate packet using port1 neighbor IP as destination IP, VLAN Interface MAC (Switch MAC) as destination MAC.
2. Send packet from lag1 port18
3. Verify packets appear on Port1(Baseline check).
4. Disable ingress on lag1 member port18
5. Send packet in step1 again from lag1 port18
6. Check if Packet drop on port1

## Test Group3: Remove/Add LAG member
### Case8: test_remove_lag_member
### Case9: test_add_lag_member
### Testing Objective <!-- omit in toc -->
These cases will cover adding and removing the lag members. We can remove or add a lag member, then expect traffic to drop/appear on the lag member.

### Test steps: <!-- omit in toc -->
- test_remove_lag_member

1. Generate different packets by updating different factors for each case. The factor includes source port(L4), destination port(L4), source IP, and destination IP of the packet. Packets use lag1 neighbor IPs as destination IP and lag1 MAC (Switch MAC) as destination MAC.
2. Send packet from port1
3. Verify packets appear on lag1 port18(Baseline check).
4. Remove port18 from lag1
5. Send packets in step1 from port1 again
6. Check if the Packet drop on port18

- test_add_lag_member

1. Add port21 to lag1
2. Create packets with variations of the src_ip, dest_ip, src_port,dest_port.(dest_ip is lag1 neighbor IP and MAC is lag1 neighbor MAC)
3. Send packet from port1
4. Verify packets appear on all the lag1 members, including port21.


## Test Group4: Indifference Ingress Port in Hash
### Case10: test_ingress_port_hash_indiff

### Test Objective
This case will verify the ingress ports should not be as a Hash Factor in Lag loadbalance.
When forwarding the packet from different ingress ports, if only the ingress port changed, then the loadbalance should not happen among lag members.

### Test steps: <!-- omit in toc -->
1. Generate packet using one lag1 neighbor IP as destination IP, lag1 MAC (Switch MAC) as destination MAC, and keep all packets from different ports have the same src_ip, dest_ip, src_port(L4),dest_port(L4), and protocol.
2. Send packet from Port1 ~ Port16
3. Verify packets only appear on one LAG member port
Loading