]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: dict_values are not lists in version 3 7758/head
authorDonald Sharp <sharpd@nvidia.com>
Thu, 17 Dec 2020 19:04:21 +0000 (14:04 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Sat, 19 Dec 2020 00:12:30 +0000 (19:12 -0500)
While accidently running the topotests with version 3
I keep getting:

TypeError: `dict_values` object does not support indexing..

version 2 of python dict.values() returns a list.
version 3 does not

Write some code to allow both to be handled.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
tests/topotests/lib/bgp.py

index ddeaf55b330b15f402b9240436f9ff689ba2bb75..0462cfbff85683fadb1466118264145b5e962f6a 100644 (file)
@@ -2129,7 +2129,9 @@ def verify_bgp_attributes(
             dict_to_test = []
             tmp_list = []
 
-            if "route_maps" in input_dict.values()[0]:
+            dict_list = list(input_dict.values())[0]
+
+            if "route_maps" in dict_list:
                 for rmap_router in input_dict.keys():
                     for rmap, values in input_dict[rmap_router]["route_maps"].items():
                         if rmap == rmap_name: