diff options
author | Neale Ranns <neale@graphiant.com> | 2021-06-03 14:43:21 +0000 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-06-14 13:12:34 +0000 |
commit | 6197cb730e1571ca69859489c0ae7ea90a5c5fd4 (patch) | |
tree | 769f178533896318ed98c0014987169d24db94db /test/framework.py | |
parent | 52c33d60bc63626d400067e38ab0af312fdb8594 (diff) |
pg: A Tunnel mode variant of a pg interface
Type: feature
this allows VPP to simulate linux tun devices.
Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I3adf38b49a254804370f78edd5d275d192fd00a6
Diffstat (limited to 'test/framework.py')
-rwxr-xr-x | test/framework.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/test/framework.py b/test/framework.py index c2a2fc68430..2afec7a4f0f 100755 --- a/test/framework.py +++ b/test/framework.py @@ -32,6 +32,7 @@ from vpp_sub_interface import VppSubInterface from vpp_lo_interface import VppLoInterface from vpp_bvi_interface import VppBviInterface from vpp_papi_provider import VppPapiProvider +from vpp_papi import VppEnum import vpp_papi from vpp_papi.vpp_stats import VPPStats from vpp_papi.vpp_transport_socket import VppTransportSocketIOError @@ -915,7 +916,8 @@ class VppTestCase(CPUInterface, unittest.TestCase): cls._pcaps = [] @classmethod - def create_pg_interfaces(cls, interfaces, gso=0, gso_size=0): + def create_pg_interfaces_internal(cls, interfaces, gso=0, gso_size=0, + mode=None): """ Create packet-generator interfaces. @@ -925,13 +927,37 @@ class VppTestCase(CPUInterface, unittest.TestCase): """ result = [] for i in interfaces: - intf = VppPGInterface(cls, i, gso, gso_size) + intf = VppPGInterface(cls, i, gso, gso_size, mode) setattr(cls, intf.name, intf) result.append(intf) cls.pg_interfaces = result return result @classmethod + def create_pg_ip4_interfaces(cls, interfaces, gso=0, gso_size=0): + pgmode = VppEnum.vl_api_pg_interface_mode_t + return cls.create_pg_interfaces_internal(interfaces, gso, gso_size, + pgmode.PG_API_MODE_IP4) + + @classmethod + def create_pg_ip6_interfaces(cls, interfaces, gso=0, gso_size=0): + pgmode = VppEnum.vl_api_pg_interface_mode_t + return cls.create_pg_interfaces_internal(interfaces, gso, gso_size, + pgmode.PG_API_MODE_IP6) + + @classmethod + def create_pg_interfaces(cls, interfaces, gso=0, gso_size=0): + pgmode = VppEnum.vl_api_pg_interface_mode_t + return cls.create_pg_interfaces_internal(interfaces, gso, gso_size, + pgmode.PG_API_MODE_ETHERNET) + + @classmethod + def create_pg_ethernet_interfaces(cls, interfaces, gso=0, gso_size=0): + pgmode = VppEnum.vl_api_pg_interface_mode_t + return cls.create_pg_interfaces_internal(interfaces, gso, gso_size, + pgmode.PG_API_MODE_ETHERNET) + + @classmethod def create_loopback_interfaces(cls, count): """ Create loopback interfaces. |