summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-05-24 09:39:49 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-24 09:39:49 +0200
commit722b88d3d88c8c89cf7bd90b52c97460338b60fa (patch)
tree900d4122a3ed55cac3e45f825c395a64975bc721 /smoketest/scripts/cli
parent06dae2734aee09885e34aec0df397985c2a36961 (diff)
downloadvyos-1x-722b88d3d88c8c89cf7bd90b52c97460338b60fa.tar.gz
vyos-1x-722b88d3d88c8c89cf7bd90b52c97460338b60fa.zip
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.
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_pseudo_ethernet.py19
1 files changed, 15 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>.
+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()