summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/topojson.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/lib/topojson.py')
-rw-r--r--tests/topotests/lib/topojson.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/topotests/lib/topojson.py b/tests/topotests/lib/topojson.py
index 0e59f90a20..88e6f78b92 100644
--- a/tests/topotests/lib/topojson.py
+++ b/tests/topotests/lib/topojson.py
@@ -43,6 +43,7 @@ from lib.common_config import (
create_vrf_cfg,
)
+from lib.pim import create_pim_config, create_igmp_config
from lib.bgp import create_router_bgp
from lib.ospf import create_router_ospf
@@ -68,20 +69,18 @@ def build_topo_from_json(tgen, topo):
topo["switches"].keys(), key=lambda x: int(re_search("\d+", x).group(0))
)
- listRouters = ROUTER_LIST[:]
- listSwitches = SWITCH_LIST[:]
+ listRouters = sorted(ROUTER_LIST[:])
+ listSwitches = sorted(SWITCH_LIST[:])
listAllRouters = deepcopy(listRouters)
dictSwitches = {}
for routerN in ROUTER_LIST:
logger.info("Topo: Add router {}".format(routerN))
tgen.add_router(routerN)
- listRouters.append(routerN)
for switchN in SWITCH_LIST:
logger.info("Topo: Add switch {}".format(switchN))
dictSwitches[switchN] = tgen.add_switch(switchN)
- listSwitches.append(switchN)
if "ipv4base" in topo:
ipv4Next = ipaddress.IPv4Address(topo["link_ip_start"]["ipv4"])
@@ -101,18 +100,8 @@ def build_topo_from_json(tgen, topo):
curRouter = listRouters.pop(0)
# Physical Interfaces
if "links" in topo["routers"][curRouter]:
-
- def link_sort(x):
- if x == "lo":
- return 0
- elif "link" in x:
- return int(x.split("-link")[1])
- else:
- return int(re_search("\d+", x).group(0))
-
for destRouterLink, data in sorted(
- topo["routers"][curRouter]["links"].items(),
- key=lambda x: link_sort(x[0]),
+ topo["routers"][curRouter]["links"].iteritems()
):
currRouter_lo_json = topo["routers"][curRouter]["links"][destRouterLink]
# Loopback interfaces
@@ -321,6 +310,8 @@ def build_config_from_json(tgen, topo, save_bkup=True):
("prefix_lists", create_prefix_lists),
("bgp_community_list", create_bgp_community_lists),
("route_maps", create_route_maps),
+ ("pim", create_pim_config),
+ ("igmp", create_igmp_config),
("bgp", create_router_bgp),
("ospf", create_router_ospf),
]