open-traffic-generator / snappi

Open Traffic Generator SDK in Python and Go
MIT License
68 stars 7 forks source link

snappi has to provide a backend capabilities list #188

Open anton7811 opened 1 year ago

anton7811 commented 1 year ago

When I'm writing a script using snappi I want to be able to execute it against multiple TG backends (Ixia-C or IxNet). And I want to have a smart way to skip some logic if it is not supported. That could be something like a get_capability() call.

Real-world example: I'm creating a test suite with traffic that is expected to be running on the emulator and real hardware. In the first case I will be using Ixia-C, and in the 2d - IxNetwork. But I don't want to make any changes in the test code. So I should be able to do one of two:

  1. Skip the test e.g. in pytest - @pytest.skipif(snappi.get_capabilities().vxlan_control_plane == False)
  2. In the code itself do some ifs:
    if snappi.get_capabilities().vxlan_control_plane == True:
    do_extra_configuration()
    else:
    logging.warning("Skipping VXLAN control plane configuration")