start ospfd only when ospf config is used.
Signed-off-by: nguggarigoud <nguggarigoud@vmware.com>
return True
-def start_topology(tgen):
+def start_topology(tgen, daemon=None):
"""
Starting topology, create tmp files which are loaded to routers
to start deamons and then start routers
router.load_config(
TopoRouter.RD_ZEBRA, "{}/{}/zebra.conf".format(TMPDIR, rname)
)
+
# Loading empty bgpd.conf file to router, to start the bgp deamon
router.load_config(TopoRouter.RD_BGP, "{}/{}/bgpd.conf".format(TMPDIR, rname))
- # Loading empty ospf.conf file to router, to start the bgp deamon
- router.load_config(
- TopoRouter.RD_OSPF,
- '{}/{}/ospfd.conf'.format(TMPDIR, rname)
- )
+ if daemon and 'ospfd' in daemon:
+ # Loading empty ospf.conf file to router, to start the bgp deamon
+ router.load_config(
+ TopoRouter.RD_OSPF,
+ '{}/{}/ospfd.conf'.format(TMPDIR, rname)
+ )
# Starting routers
logger.info("Starting all routers once topology is created")
tgen.start_router()
return ord(routerName[0]) - 97
+def topo_daemons(tgen, topo):
+ """
+ Returns daemon list required for the suite based on topojson.
+ """
+ daemon_list = []
+
+ router_list = tgen.routers()
+ ROUTER_LIST = sorted(
+ router_list.keys(), key=lambda x: int(re_search("\d+", x).group(0))
+ )
+
+ for rtr in ROUTER_LIST:
+ if 'ospf' in topo['routers'][rtr] and 'ospfd' not in daemon_list:
+ daemon_list.append('ospfd')
+
+ return daemon_list
+
+
#############################################
# Common APIs, will be used by all protocols
#############################################
reset_config_on_routers,
step,
shutdown_bringup_interface,
+ topo_daemons
)
from lib.topolog import logger
from lib.topojson import build_topo_from_json, build_config_from_json
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
create_route_maps,
shutdown_bringup_interface,
create_interfaces_cfg,
+ topo_daemons
)
from lib.topolog import logger
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
shutdown_bringup_interface,
stop_router,
start_router,
+ topo_daemons
)
from lib.bgp import verify_bgp_convergence, create_router_bgp
from lib.topolog import logger
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
+
# Creating configuration from JSON
build_config_from_json(tgen, topo)
shutdown_bringup_interface,
stop_router,
start_router,
+ topo_daemons
)
from lib.bgp import verify_bgp_convergence, create_router_bgp
from lib.topolog import logger
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
create_route_maps,
shutdown_bringup_interface,
create_interfaces_cfg,
+ topo_daemons
)
from ipaddress import IPv4Address
from lib.topogen import Topogen, get_topogen
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
+
# Creating configuration from JSON
build_config_from_json(tgen, topo)
step,
create_route_maps,
verify_prefix_lists,
+ topo_daemons
)
from lib.topolog import logger
from lib.topojson import build_topo_from_json, build_config_from_json
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
create_static_routes,
step,
shutdown_bringup_interface,
+ topo_daemons
)
from lib.bgp import verify_bgp_convergence, create_router_bgp
from lib.topolog import logger
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
create_route_maps,
shutdown_bringup_interface,
create_interfaces_cfg,
+ topo_daemons
)
from lib.topolog import logger
from lib.topojson import build_topo_from_json, build_config_from_json
tgen = Topogen(CreateTopo, mod.__name__)
# ... and here it calls Mininet initialization functions.
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
# Starting topology, create tmp files which are loaded to routers
# to start deamons and then start routers
- start_topology(tgen)
+ start_topology(tgen, daemons)
# Creating configuration from JSON
build_config_from_json(tgen, topo)