diff options
author | Daniil Baturin <daniil@vyos.io> | 2022-04-08 17:48:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 17:48:40 +0300 |
commit | 298ce87e8fc444cd42ec10a43a2eb446b71febd6 (patch) | |
tree | 32c6385abd91ae6f9c854d7e24535b2d596d0c97 /smoketest | |
parent | 25d65249bd81f6405dcf6b6b94bb4ea23436d532 (diff) | |
parent | 409a2e1239e66cdac0cb244281ee725a16180dcf (diff) | |
download | vyos-1x-298ce87e8fc444cd42ec10a43a2eb446b71febd6.tar.gz vyos-1x-298ce87e8fc444cd42ec10a43a2eb446b71febd6.zip |
Merge pull request #1273 from c-po/t4331-equuleus
T4331: IPv6 link local addresses are not configured when an interface is in a VRF (equuleus)
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_vrf.py | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index 75be9e4f8..6614aeb06 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -223,11 +223,11 @@ class VRFTest(VyOSUnitTestSHIM.TestCase): # commit changes self.cli_commit() - # Verify & cleanup + # Verify VRF assignmant for interface in self._interfaces: - # os.readlink resolves to: '../../../../../virtual/net/foovrf' - tmp = os.readlink(f'/sys/class/net/{interface}/master').split('/')[-1] - self.assertEqual(tmp, vrf) + tmp = get_interface_config(interface) + self.assertEqual(vrf, tmp['master']) + # cleanup section = Section.section(interface) self.cli_delete(['interfaces', section, interface, 'vrf']) @@ -299,5 +299,45 @@ class VRFTest(VyOSUnitTestSHIM.TestCase): self.cli_delete(['interfaces', 'ethernet', 'eth0', 'address']) + def test_vrf_link_local_ip_addresses(self): + # Testcase for issue T4331 + table = '100' + vrf = 'orange' + interface = 'dum9998' + addresses = ['192.0.2.1/26', '2001:db8:9998::1/64', 'fe80::1/64'] + + for address in addresses: + self.cli_set(['interfaces', 'dummy', interface, 'address', address]) + + # Create dummy interfaces + self.cli_commit() + + # ... and verify IP addresses got assigned + for address in addresses: + self.assertTrue(is_intf_addr_assigned(interface, address)) + + # Move interface to VRF + self.cli_set(base_path + ['name', vrf, 'table', table]) + self.cli_set(['interfaces', 'dummy', interface, 'vrf', vrf]) + + # Apply VRF config + self.cli_commit() + # Ensure VRF got created + self.assertIn(vrf, interfaces()) + # ... and IP addresses are still assigned + for address in addresses: + self.assertTrue(is_intf_addr_assigned(interface, address)) + # Verify VRF table ID + tmp = get_interface_config(vrf) + self.assertEqual(int(table), tmp['linkinfo']['info_data']['table']) + + # Verify interface is assigned to VRF + tmp = get_interface_config(interface) + self.assertEqual(vrf, tmp['master']) + + # Delete Interface + self.cli_delete(['interfaces', 'dummy', interface]) + self.cli_commit() + if __name__ == '__main__': unittest.main(verbosity=2) |