From 4ab7460e67b06b82df79bdfe3afdc7da645aa2b0 Mon Sep 17 00:00:00 2001 From: Manuel Domke Date: Tue, 4 Apr 2017 14:21:11 +0200 Subject: [PATCH 1/2] added test for get_route_to (IPv6 static routes) --- napalm_base/test/getters.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/napalm_base/test/getters.py b/napalm_base/test/getters.py index db6ebdb7..abb51d8f 100644 --- a/napalm_base/test/getters.py +++ b/napalm_base/test/getters.py @@ -365,6 +365,21 @@ def test_get_route_to(self, test_case): return get_route_to + @wrap_test_cases + def test_get_route_to_v6(self, test_case): + """Test get_route_to_v6.""" + destination = 'dead:beef:210:210::53/64' + protocol = 'static' + get_route_to = self.device.get_route_to(destination=destination, protocol=protocol) + + assert len(get_route_to) > 0 + + for prefix, routes in get_route_to.items(): + for route in routes: + assert helpers.test_model(models.route, route) + + return get_route_to + @wrap_test_cases def test_get_snmp_information(self, test_case): """Test get_snmp_information.""" From f764f60fc55cea1f6ea9389d978e5fd6b9c2dfbc Mon Sep 17 00:00:00 2001 From: Manuel Domke Date: Tue, 4 Apr 2017 14:32:50 +0200 Subject: [PATCH 2/2] a test for static ipv4 routes --- napalm_base/test/getters.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/napalm_base/test/getters.py b/napalm_base/test/getters.py index abb51d8f..a65a5f65 100644 --- a/napalm_base/test/getters.py +++ b/napalm_base/test/getters.py @@ -366,8 +366,23 @@ def test_get_route_to(self, test_case): return get_route_to @wrap_test_cases - def test_get_route_to_v6(self, test_case): - """Test get_route_to_v6.""" + def test_get_route_to_static_v4(self, test_case): + """Test get_route_to with static ipv4 route""" + destination = '1.0.4.0/24' + protocol = 'static' + get_route_to = self.device.get_route_to(destination=destination, protocol=protocol) + + assert len(get_route_to) > 0 + + for prefix, routes in get_route_to.items(): + for route in routes: + assert helpers.test_model(models.route, route) + + return get_route_to + + @wrap_test_cases + def test_get_route_to_static_v6(self, test_case): + """Test get_route_to with static ipv6 route""" destination = 'dead:beef:210:210::53/64' protocol = 'static' get_route_to = self.device.get_route_to(destination=destination, protocol=protocol)