Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance the y_cable driver to support hook y_cable_simulator_client (s…
…onic-net#153) In SONiC testbed, y_cable is simulated by OVS in test server. An OVS bridge is created for each of the y_cable. The PTF interface and test server VLAN interfaces are attached to the bridge. The VLAN interfaces are connected to DUT ports through fanout switches. +--------------+ | +----- upper_if PTF (host_if) --+ OVS bridge | | +----- lower_if +--------------+ Open flow rules are configured for the OVS bridge to simulate upstream broadcasting and downstream dropping traffic from standby side. To further simulate y_cable active/standby querying and switching, a process can be started in the test server. The process needs to expose APIs for querying and switching active/standby status. When the APIs are called, the process checks and updates open flow configurations of the OVS bridge accordingly. On SONiC side, we need to intercept the calls to y_cable driver and call the APIs exposed by the process running in test server. This change is to enhance the y_cable driver to support calling hook functions defined in y_cable_simulator_client when the module is found. To do that, a decorator is added to each of the functions in the y_cable driver. When a y_cable function is called, it firstly checks if module y_cable_simulator_client is found and the module has function with the same name. If yes, then call the function of y_cable_simulator_client and return the result. Otherwise, call the original y_cable driver function. Signed-off-by: Xin Wang <xiwang5@microsoft.com>
- Loading branch information