From 79f44d3cf8dc366e652f9fa01b34eff5314830ec Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 2 Jan 2021 12:20:34 +0100 Subject: vrf: T2321: assign loopback IP addresses to individual VRF interfaces 47: bar: mtu 65536 qdisc noqueue state UP group default qlen 1000 link/ether 76:7d:c0:53:6d:89 brd ff:ff:ff:ff:ff:ff inet 127.0.0.1/8 scope host bar valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever --- smoketest/scripts/cli/test_vrf.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'smoketest') diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index d8ed46f0b..7bcfea861 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020 VyOS maintainers and contributors +# Copyright (C) 2020-2021 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -19,6 +19,7 @@ import unittest from vyos.configsession import ConfigSession, ConfigSessionError from vyos.util import read_file +from vyos.validate import is_intf_addr_assigned class VRFTest(unittest.TestCase): def setUp(self): @@ -31,7 +32,7 @@ class VRFTest(unittest.TestCase): self.session.commit() del self.session - def test_table_id(self): + def test_vrf_table_id(self): table = 1000 for vrf in self._vrfs: base = ['vrf', 'name', vrf] @@ -48,5 +49,18 @@ class VRFTest(unittest.TestCase): # commit changes self.session.commit() + def test_vrf_loopback_ips(self): + table = 1000 + for vrf in self._vrfs: + base = ['vrf', 'name', vrf] + self.session.set(base + ['table', str(table)]) + table += 1 + + # commit changes + self.session.commit() + for vrf in self._vrfs: + self.assertTrue(is_intf_addr_assigned(vrf, '127.0.0.1')) + self.assertTrue(is_intf_addr_assigned(vrf, '::1')) + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3