Skip to content

Adding IPv4 and IPv6 ERSPAN tests#16752

Closed
mramezani95 wants to merge 5 commits intosonic-net:masterfrom
mramezani95:mramezani/test_erspan
Closed

Adding IPv4 and IPv6 ERSPAN tests#16752
mramezani95 wants to merge 5 commits intosonic-net:masterfrom
mramezani95:mramezani/test_erspan

Conversation

@mramezani95
Copy link
Copy Markdown
Contributor

@mramezani95 mramezani95 commented Jan 31, 2025

Description of PR

Summary:
Microsoft ADO id: 30441649
This PR adds IPv4 and IPv6 ERSPAN tests.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms: IPv6 ERSPAN tests are skipped for Broadcom ASICs.
  • Test case improvement

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

After PR 3317 in sonic-swss repo, it is possible to configure ERSPAN sessions with IPv6 source and destination addresses. The main objective of this PR is to add IPv6 ERSPAN tests, but we have also added IPv4 ERSPAN tests.

How did you do it?

We select 3 sets of ports on the DUT:

  1. Mirrored ports: Packets sent out or received on these ports (depending on the ERSPAN session's direction) will be mirrored to the ERSPAN destination address.
  2. Monitor ports: We modify the routing table so that encapsulated mirror packets will be sent out on one of these ports.
  3. TX source port: In order to verify that TX packets on one of the mirrored ports are mirrored correctly, we send an ICMP packet to the TX source port. The routing table is modified such that this packet is sent out from one of the mirrored ports.

RX ERSPAN tests:

  • Add a static route to 2.2.2.2 or fc00::2:2:2:2 (i.e., the IPv4 or IPv6 mirror destination) so that GRE encapsulated packets are sent on monitor ports.
  • Send an ICMP echo request from PTF to one of the mirrored ports.
  • Verify that the RX packet is mirrored exactly to one of the monitor ports.

TX ERSPAN tests:

  • Add a static route to 3.3.3.3 so that the ICMP packet received on the TX source port will be forwarded on one of the mirrored ports.
  • Also add a static route to 2.2.2.2 or fc00::2:2:2:2 (similar to RX ERSPAN tests).
  • Send an ICMP echo request with destination IP set to 3.3.3.3 from PTF to the TX source port.
  • Verify that the RX packet is mirrored to one of the monitor ports (with some fields such as Ethernet source and destination MACs and IP TTL modified by the DUT).

How did you verify/test it?

Tested on the following platforms:

  1. Mellanox T0
  2. Broadcom T0
  3. Mellanox T1-LAG

Any platform specific information?

IPv6 ERSPAN tests are skipped on Broadcom ASICs since Broadcom does not support IPv6 as an ERSPAN delivery method.

Supported testbed topology if it's a new test case?

T0, T1 and their variations.
These tests are not designed to be run on T2 switches.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny requested a review from bingwang-ms January 31, 2025 21:24
@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Jan 31, 2025

Please add MSFT ADO id to description

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Feb 1, 2025

sonic-mgmt tests for PR implementation - sonic-net/sonic-swss#3317

@bingwang-ms
Copy link
Copy Markdown
Collaborator

This comment maybe too late. I was just wondering why not implement the test based on the existing everflow test? I think it could be more straightforward.

@mramezani95
Copy link
Copy Markdown
Contributor Author

This comment maybe too late. I was just wondering why not implement the test based on the existing everflow test? I think it could be more straightforward.

The purpose of these tests was to only test the ERSPAN feature. The Everflow tests are more comprehensive (e.g., they also define and test ACL rules).
Another reason was that, as I mentioned above, the Everflow tests use the sudo config mirror_session add ... command, which is deprecated and does not allow the monitor port(s) to be specified. I did not change this command in Everflow tests so that I don't inadvertently break them.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mramezani95 mramezani95 changed the title Adding IPv6 SPAN tests and IPv4 and IPv6 ERSPAN tests Adding IPv4 and IPv6 ERSPAN tests Feb 4, 2025
…ERSPAN session with source port(s) and direction.

Signed-off-by: Mahdi Ramezani <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Mahdi Ramezani <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants