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
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"])
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
("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),
]