Skip to content

[dualtor] Add nic_simulator#5413

Merged
lolyu merged 6 commits intosonic-net:masterfrom
lolyu:add_nic_simulator
Apr 18, 2022
Merged

[dualtor] Add nic_simulator#5413
lolyu merged 6 commits intosonic-net:masterfrom
lolyu:add_nic_simulator

Conversation

@lolyu
Copy link
Collaborator

@lolyu lolyu commented Mar 28, 2022

Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012

Approach

What is the motivation for this PR?

Add nic_simulator to act as gRPC server to respond to requests from DUT operates in dualtor active-active mode.

Signed-off-by: Longxiang Lyu [email protected]

How did you do it?

Add script nic_simulator.py to start per-port gRPC server for a dualtor active-active setup testbed. It should run in the server NiCs namespace, and it basically does the following few things after it starts:

  1. scans for all the ports in the namespace that follows the server NiC name pattern(eth%d) and finds its corresponding OVS bridge, the bridge will be verified to have the following topology:
                                   +--------------+
                   PTF (host_if) --+              +----- upper_if
                                   |  OVS bridge  |
    simulator netns (server_nic) --+              +----- lower_if
                                   +--------------+
  1. starts to set up the flows for each OVS bridge collected in step1, the initial forwarding state is (active, active).

    • the flows added:
      • FLOW I: for packets from upper_if, it will be duplicated to host_if and server_nic.
      • FLOW II: for packets from lower_if, it will be duplicated to host_if and server_nic.
      • FLOW III: for packets from server_nic, it will be duplicated to upper_if and lower_if.
      • FLOW IV: for packets from host_if, it will be directed to either upper_if or lower_if.
  2. starts the gRPC services(one port, one server) to query/set the forwarding state of the bridge.

    • if upper ToR forwarding state is set to standby, nic_simulator will modify FLOW IV to let packets from host_if only be directed to lower ToR(active)

TODO

  1. Add RPC calls to cover testing scenarios like link drop and link down.
  2. Add client authentication.
  3. Implement RPC call QueryOperationPortState
  4. add logging interceptors to the RPC calls.

How did you verify/test it?

  1. run the nic_simulator.py
  2. run the nic_simulator_client.py to verify nic_simulator operations.

Any platform specific information?

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

Documentation

Signed-off-by: Longxiang Lyu <[email protected]>
@lolyu lolyu requested a review from a team as a code owner March 28, 2022 10:28
@lgtm-com
Copy link

lgtm-com bot commented Mar 28, 2022

This pull request introduces 3 alerts when merging 8492bd6f60faa85c92dfa1580f9ce2d247594287 into 09a965d - view on LGTM.com

new alerts:

  • 2 for Signature mismatch in overriding method
  • 1 for Module is imported more than once

@lolyu lolyu force-pushed the add_nic_simulator branch from 8492bd6 to 4b012e2 Compare March 28, 2022 12:45
Signed-off-by: Longxiang Lyu <[email protected]>
@lolyu lolyu force-pushed the add_nic_simulator branch from 4b012e2 to 5ae1b6c Compare March 28, 2022 12:57
@lolyu
Copy link
Collaborator Author

lolyu commented Mar 28, 2022

/AZP run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Longxiang Lyu <[email protected]>
@lolyu
Copy link
Collaborator Author

lolyu commented Apr 6, 2022

/AZP run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lgtm-com
Copy link

lgtm-com bot commented Apr 11, 2022

This pull request introduces 1 alert when merging bc017bb into e67fbec - view on LGTM.com

new alerts:

  • 1 for Signature mismatch in overriding method

Signed-off-by: Longxiang Lyu <[email protected]>
@yxieca
Copy link
Collaborator

yxieca commented Apr 14, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lolyu lolyu merged commit 4cfce43 into sonic-net:master Apr 18, 2022
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.

2 participants