Commit b3d1662a authored by Simon Redman's avatar Simon Redman

Add optional ignore parameter to top-level frr_configurator methods

parent 05a167c0
......@@ -164,7 +164,7 @@ def build_zebra_confs_for_network(netgraph):
return zebra_confs
def configure_nodes(netgraph):
def configure_nodes(netgraph, ignore_nodes=[]):
"""
Create ospf6d and zebra conf files, push them to the relevant nodes, and enable the daemons
......@@ -177,17 +177,18 @@ def configure_nodes(netgraph):
zebra_enable_commands = []
hosts = [host for host in netgraph.nodes]
sessions = [session for session in map(lambda host : netgraph._node[host]['session'], hosts)]
sessions = list(map(lambda host : netgraph._node[host]['session'], [host for host in netgraph.nodes if host not in ignore_nodes]))
ospf_confs = build_ospf_confs_for_network(netgraph)
zebra_confs = build_zebra_confs_for_network(netgraph)
# Disable integrated config mode
disable_integrated_commands = [DISABLE_INTEGRATED_COMMAND for host in hosts]
disable_integrated_commands = [DISABLE_INTEGRATED_COMMAND for host in hosts if host not in ignore_nodes]
outputs = ssh_helper.run_commands_on_many_hosts(sessions, disable_integrated_commands)
# Push ospf6d and zebra configurations to all nodes, then enable both services
for host in hosts:
if host in ignore_nodes: continue # Skip nodes which we have been asked to skip
ospfd_push_command = CONFIG_PUSH_COMMAND_TEMPLATE.format(
config=ospf_confs[host],
filename=OSPF_CONF_FILENAME,
......@@ -216,14 +217,14 @@ def configure_nodes(netgraph):
outputs = ssh_helper.run_commands_on_many_hosts(sessions, zebra_enable_commands)
def start_frr_on_network(netgraph):
def start_frr_on_network(netgraph, ignore_nodes=[]):
"""
Restart (or start) frr on all nodes in the network
:param netgraph: networkx graph representing the network
:return: None
"""
sessions = [session for session in map(lambda host : netgraph._node[host]['session'], netgraph.nodes)]
sessions = list(map(lambda host : netgraph._node[host]['session'], [host for host in netgraph.nodes if host not in ignore_nodes]))
commands = [START_DAEMON_COMMAND for session in sessions]
ssh_helper.run_commands_on_many_hosts(sessions, commands)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment