Skip to content

Commit

Permalink
Add VLAN and PortChannel test plan (opencomputeproject#1480)
Browse files Browse the repository at this point in the history
* Add VLAN and PortChannel test plan

For vlan, it includes:
1. Vlan functionalities
   - Flooding
   - Forwarding
   - Trunk/Access
   - Tagging/Untagging(802.1Q)
   - VLAN interface (RIF/SVI)
2. SAI APIs operations
   - Vlan Counters
   - Vlan and member list operations

For PortChannel, it includes:
1. Lag functionalities
    - Loadbalance
2. Lag SAI APIs
    - create/check/remove lag and lag member

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* Update lag_test_plan.md

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* Update lag_test_plan.md

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* remove cases not related to T0

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* Update lag_test_plan.md

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* Add VLAN and Lag test plan and put topo config in seperated files

Signed-off-by: richardyu <richardyu@contoso.com>

* fix typo and more description more clear

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* fix lag test typo (#29)

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* refactor vlan test plan and config

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* refactor lag test plan (#33)

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* refactor pc and vlan test

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* Improve pc and vlan test Doc (#35)

* fix typo

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* remove some unnecessary comments

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* reformat and adjust the description of the tests

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* set hash algorithm (#36)

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* refine lag test (#37)

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* correct vlan interface test (#38)

Signed-off-by: zhoudongxu <Dongxu.Zhou@microsoft.com>

* workaround for the sequence number issue in github and correct typo
standardise the ip and mac naming in config

add lag test for ingress port indifferenate in lag hash
redesign the mac and ip namin convention and reformat
Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

* adjust the case numbers and vlan id

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

Co-authored-by: zhoudongxu <1315364814@qq.com>
Co-authored-by: richardyu <richardyu@contoso.com>
Co-authored-by: zhoudongxu <Dongxu.Zhou@microsoft.com>
  • Loading branch information
4 people authored Jun 19, 2022
1 parent fe69c82 commit a70c6ec
Show file tree
Hide file tree
Showing 3 changed files with 601 additions and 0 deletions.
148 changes: 148 additions & 0 deletions doc/sai-ptf/config_data/config_t0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# 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
```
00:TITLE_L1_NUM:TITLE_L2_NUM:ROLE:EXTRA:SEQ
ROLE: T1=1, Server=99
```

For example:
For the MAC address in ``1.1 FDB Configuration``.
`1.1` is the title number.
```
#Server MAC
00:01:01:99:02:01~00:01:01: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.1.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 |00:01:01:99:01:01 - 00:01:01:99:01:08|Port1-8|10|Ethernet4-Ethernet32|
|mac9-16 |00:01:01:99:02:09 - 00:01:01: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.
```
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 |00:01:01:99:01:01 - 00:01:01:99:01:08|
|vlan20_nb1-nb8|Port9-16|192.168.2.9 ~ 192.168.2.16 |00:01:01:99:02:09 - 00:01:01:99:02:16|


### 2.4.2 LAG Neighbors

|Name|Port|IP|dest_mac|
|-|-|-|-|
|lag1_nb|lag1| 10.1.1.101 | 02:04:02:01:01:01|
|lag2_nb|lag2| 10.1.2.101 | 02:04:02:01:02:01|
154 changes: 154 additions & 0 deletions doc/sai-ptf/lag_test_plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# 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)
- [Case1: test_disable_egress](#case1-test_disable_egress)
- [Case2: test_disable_ingress](#case2-test_disable_ingress)
- [Test Group3: Remove/Add LAG member](#test-group3-removeadd-lag-member)
- [Case1: test_remove_lag_member](#case1-test_remove_lag_member)
- [Case2: test_add_lag_member](#case2-test_add_lag_member)
- [Test Group4: Indifference Ingress Port in Hash](#test-group4-indifference-ingress-port-in-hash)
- [Case1: test_ingress_port_hash_indiff](#case1-test_ingress_port_hash_indiff)
# 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


### Case1: test_disable_egress
### Case2: 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
### Case1: test_remove_lag_member
### Case2: 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
### Case1: test_ingress_port_hash_indiff

### Test Objective <!-- omit in toc -->
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

0 comments on commit a70c6ec

Please sign in to comment.