From 722b88d3d88c8c89cf7bd90b52c97460338b60fa Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 24 May 2021 09:39:49 +0200 Subject: smoketest: pseudo-ethernet: support setting source-interface via ENV TEST_ETH="eth2" /usr/libexec/vyos/tests/smoke/cli/test_interfaces_pseudo_ethernet.py Will only create pseudo ethernet interfaces from eth2. --- .../scripts/cli/test_interfaces_pseudo_ethernet.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'smoketest/scripts') diff --git a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py index ff343bb87..a196ff0e7 100755 --- a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os import unittest from base_interfaces_test import BasicInterfaceTest @@ -29,10 +30,20 @@ class PEthInterfaceTest(BasicInterfaceTest.TestCase): cls._test_vlan = True cls._test_qinq = True cls._base_path = ['interfaces', 'pseudo-ethernet'] - cls._options = { - 'peth0': ['source-interface eth1'], - 'peth1': ['source-interface eth1'], - } + + cls._options = {} + # we need to filter out VLAN interfaces identified by a dot (.) + # in their name - just in case! + if 'TEST_ETH' in os.environ: + for tmp in os.environ['TEST_ETH'].split(): + cls._options.update({f'p{tmp}' : [f'source-interface {tmp}']}) + + else: + for tmp in Section.interfaces('ethernet'): + if '.' in tmp: + continue + cls._options.update({f'p{tmp}' : [f'source-interface {tmp}']}) + cls._interfaces = list(cls._options) # call base-classes classmethod super(cls, cls).setUpClass() -- cgit v1.2.3