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

[Sub-ports] Added new sub-ports test cases #2669

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
135 changes: 128 additions & 7 deletions tests/sub_port_interfaces/Sub-ports-test-plan.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sub-port interfaces Test Plan

## Rev 0.1
## Rev 0.3

- [Revision](#revision)
- [Overview](#overview)
Expand All @@ -10,13 +10,17 @@
- [Test Cases](#Test-cases)
- [test_packet_routed_with_valid_vlan](#Test-case-test_packet_routed_with_valid_vlan)
- [test_packet_routed_with_invalid_vlan](#Test-case-test_packet_routed_with_invalid_vlan)
- [test_admin_status_down_disables_forwarding](#Test-case-test_admin_status_down_disables_forwarding)
- [test_max_numbers_of_sub_ports](#Test-case-test_max_numbers_of_sub_ports)
- [test_mtu_inherited_from_parent_port](#Test-case-test_mtu_inherited_from_parent_port)
- [test_vlan_config_impact](#Test-case-test_vlan_config_impact)


## Revision

| Rev | Date | Author | Change Description |
|:---:|:-----------:|:-----------------------|:-----------------------------------|
| 0.1 | 30/11/2020 | BFN: Oleksandr Kozodoi | Initial version |
| Rev | Date | Author | Change Description |
|:---:|:-----------:|:-------------------------|:-----------------------------------|
| 0.3 | 02/23/2021 | Intel: Oleksandr Kozodoi | Initial version |


## Overview
Expand All @@ -31,12 +35,12 @@ Purpose of the test is to verify a SONiC switch system correctly performs sub-po

## Testbed

Supported topologies: t0
Supported topologies: t0, t1

## Setup configuration

Each sub-ports test case needs traffic transmission.
Traffic starts transmission, if DUT and PTF directly connected interfaces have the same VLAN IDs. So we need configure correct sub-ports on the DUT and PTF.
Traffic starts transmission, if DUT and PTF directly connected interfaces have the same VLAN IDs. So we need configure correct sub-ports on the DUT and PTF.

For example the customized testbed with applied T0 topo for test_packet_routed test case looks as follows:

Expand All @@ -58,7 +62,7 @@ For example the customized testbed with applied T0 topo for test_packet_routed t
|_________________________________|

```
Port mapping:
#### Port mapping for port:
| DUT | | PTF | |
|:----------:|:-----------:|:-----------|:------------|
|**Sub-port**|**IP** |**Sub-port**|**IP** |
Expand All @@ -67,6 +71,15 @@ Port mapping:
|Ethernet8.10|172.16.4.1/30|eth2.10 |172.16.4.2/30|
|Ethernet8.20|172.16.4.5/30|eth2.20 |172.16.4.6/30|

#### Port mapping for port in LAG:
| DUT | | PTF | |
|:----------:|:-----------:|:-----------|:------------|
|**Sub-port**|**IP** |**Sub-port**|**IP** |
|PortChannel1.10|172.16.0.1/30|bond1.10 |172.16.0.2/30|
|PortChannel1.20|172.16.0.5/30|bond1.20 |172.16.0.6/30|
|PortChannel2.10|172.16.4.1/30|bond2.10 |172.16.4.2/30|
|PortChannel2.20|172.16.4.5/30|bond2.20 |172.16.4.6/30|

After end of the test session teardown procedure turns testbed to the initial state.

## Python scripts to setup and run test
Expand All @@ -75,6 +88,8 @@ Sub-ports test suite is located in tests/sub_port_interfaces folder. There is on

### Setup of DUT switch

Parent ports of sub-ports are members of Vlan1000 in the t0 topology. So we need to remove parent ports from Vlan1000 before tests running.

During setup procedure python mgmt scripts perform DUT configuration via jinja template to convert it in to the JSON file containing configuration to be pushed to the SONiC config DB via sonic-cfggen. Setup procedure configures sub-port interfaces with fixture ```define_sub_ports_configuration```.

sub_port_config.j2
Expand All @@ -90,6 +105,7 @@ sub_port_config.j2
}
}
```
Also, all test cases support LAG ports. So we need to configure additional PortChannel ports on the DUT and bond ports on the PTF before test running. We should use ```create_lag_port``` function and ```create_bond_port``` function for this. [Port mapping for port in LAG](#Port-mapping-for-port-in-LAG).

## Test cases

Expand Down Expand Up @@ -140,3 +156,108 @@ DUT and PTF directly connected interfaces have different VLAN IDs

- reload_dut_config function: reload DUT configuration
- reload_ptf_config function: remove all sub-ports configuration

## Test case test_admin_status_down_disables_forwarding

### Test objective

Validates that admin status DOWN disables packet forwarding.

### Test set up
- apply_config_on_the_dut fixture(scope="function"): enable and configures sub-port interfaces on the DUT
- apply_config_on_the_ptf fixture(scope="function"): enable and configures sub-port interfaces on the PTF

### Test steps

- Setup configuration of sub-ports on the DUT.
- Setup configuration of sub-ports on the PTF.
- Shutdown sub-ports on the DUT
- Create ICMP packet.
- Send ICMP request packet from PTF to DUT.
- Verify that DUT doesn't send ICMP reply packet to PTF.
- Create ICMP packet.
- Send ICMP request packet from PTF to another sub-port of DUT.
- Verify that DUT sends ICMP reply packet to PTF.
- Startup sub-port on the DUT
- Create ICMP packet.
- Send ICMP request packet from PTF to DUT.
- Verify that DUT sends ICMP reply packet to PTF.
- Clear configuration of sub-ports on the DUT.
- Clear configuration of sub-ports on the PTF.

### Test teardown

- reload_dut_config function: reload DUT configuration
- reload_ptf_config function: remove all sub-ports configuration
- teardown_test_class function: reload DUT configuration after running of test suite

## Test case test_max_numbers_of_sub_ports

### Test objective

Validates that 256 sub-ports can be created per port or LAG.

### Test set up
- apply_config_on_the_dut fixture(scope="function"): enable and configures sub-port interfaces on the DUT
- apply_config_on_the_ptf fixture(scope="function"): enable and configures sub-port interfaces on the PTF

### Test steps

- Setup configuration of 256 sub-ports on the DUT.
- Setup configuration of 256 sub-ports on the PTF.
- Create ICMP packet.
- Send ICMP request packet from PTF to DUT.
- Verify that DUT sends ICMP reply packet to PTF.
- Clear configuration of sub-ports on the DUT.
- Clear configuration of sub-ports on the PTF.

### Test teardown

- reload_dut_config function: reload DUT configuration
- reload_ptf_config function: remove all sub-ports configuration

## Test case test_mtu_inherited_from_parent_port

### Test objective

Validates that MTU settings of sub-ports inherited from parent port.

### Test set up
- apply_config_on_the_dut fixture(scope="function"): enable and configures sub-port interfaces on the DUT

### Test steps

- Setup correct configuration of sub-ports on the DUT.
- Get MTU value of sub-port
- Get MTU value of parent port
- Clear configuration of sub-ports on the DUT.

### Test teardown

- reload_dut_config function: reload DUT configuration

## Test case test_vlan_config_impact

### Test objective

Validates that removal of VLAN doesn't impact sub-port RIF with same VLAN ID.

### Test set up
- apply_config_on_the_dut fixture(scope="function"): enable and configures sub-port interfaces on the DUT
- apply_config_on_the_ptf fixture(scope="function"): enable and configures sub-port interfaces on the PTF

### Test steps

- Setup correct configuration of sub-ports on the DUT.
- Create a VLAN RIF with the same VLAN ID of sub-port.
- Added PortChannel interface to VLAN members
- Delete a VLAN RIF.
- Make sure sub-port is available in redis-db.
- Verify that DUT sends ICMP reply packet to PTF.
- Clear configuration of sub-ports on the DUT.
- Clear configuration of sub-ports on the PTF.

### Test teardown

- reload_dut_config function: reload DUT configuration
- reload_ptf_config function: remove all sub-ports configuration
Loading