diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-04-25 19:13:58 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-04-25 19:15:17 +0200 |
commit | f0b4aaae4fe8c680d3f472a243a4c8c2f7e4513b (patch) | |
tree | 5cd68ff5556cc27b5fcb571e76d7e0d9b543b5f4 /smoketest/scripts/cli/test_interfaces_ethernet.py | |
parent | cf91efe30fc969dff0d888cc4ff3b58a4dd8821f (diff) | |
download | vyos-1x-f0b4aaae4fe8c680d3f472a243a4c8c2f7e4513b.tar.gz vyos-1x-f0b4aaae4fe8c680d3f472a243a4c8c2f7e4513b.zip |
smoketest: ethernet: verify addresses are deleted from interface after test
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_ethernet.py')
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_ethernet.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py index 3b05da10f..e8bccd200 100755 --- a/smoketest/scripts/cli/test_interfaces_ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_ethernet.py @@ -18,10 +18,15 @@ import os import re import unittest +from netifaces import AF_INET +from netifaces import AF_INET6 +from netifaces import ifaddresses + from base_interfaces_test import BasicInterfaceTest from vyos.configsession import ConfigSessionError from vyos.ifconfig import Section from vyos.pki import CERT_BEGIN +from vyos.template import is_ipv6 from vyos.util import cmd from vyos.util import process_named_running from vyos.util import read_file @@ -140,10 +145,18 @@ class EthernetInterfaceTest(BasicInterfaceTest.TestCase): self.cli_set(self._base_path + [interface, 'speed', 'auto']) self.cli_set(self._base_path + [interface, 'hw-id', self._macs[interface]]) - # Tear down mirror interfaces for SPAN (Switch Port Analyzer) - for span in self._mirror_interfaces: - section = Section.section(span) - self.cli_delete(['interfaces', section, span]) + # Verify that no address remains on the system as this is an eternal + # interface. + for intf in self._interfaces: + self.assertNotIn(AF_INET, ifaddresses(intf)) + # required for IPv6 link-local address + self.assertIn(AF_INET6, ifaddresses(intf)) + for addr in ifaddresses(intf)[af]: + if is_ipv6(addr): + # checking link local addresses makes no sense + if is_ipv6_link_local(addr['addr']): + continue + self.assertFalse(is_intf_addr_assigned(intf, addr['addr'])) self.cli_commit() |