Commit aa7c0af7 authored by Simon Redman's avatar Simon Redman

Fix frr_configurator to actually be able to write to write-protected config directory

parent 8b9c2aa2
......@@ -37,22 +37,22 @@ service advanced-vty
router ospf6
\trouter-id {router_id}
router-id {router_id}
# interface should be replaced with the Linux interface to speak OSPF on
# One of these per interface should be put in the interfaces section.
# One of these per interface should be put in the interfaces section of the OSPF_CONF_TEMPLATE
INTERFACE_LINE_TEMPLATE = "interface {interface}"
# AREA is an OSPF concept, but it looks like FRR only implements AREA as 0
# range should be replaced with the prefix of the interface, for instance 'fd00:10:10:2:54:28ff:fe8b:1395/64'
# interface should be replaced with the interface OSPF is being used on
# One of these per interface should be put in the router_info section
ROUTER_LINE_TEMPLATE = "\tarea range {range}\n\tinterface {interface} area"
ROUTER_LINE_TEMPLATE = " area range {range}\n interface {interface} area"
OSPF_CONF_FILENAME = "/etc/frr/ospf6d.conf"
CONFIG_PUSH_COMMAND_TEMPLATE = "sudo echo '{config}' > {filename}"
CONFIG_PUSH_COMMAND_TEMPLATE = "echo '{config}' | sudo tee {filename}"
ENABLE_DAEMON_COMMAND_TEMPLATE = "sudo sed -i 's/{daemon}=no/{daemon}=yes/' /etc/frr/daemons"
......@@ -104,7 +104,7 @@ def build_ospf_confs_for_network(netgraph):
for host in netgraph.nodes:
interfaces = netgraph._node[host]['interfaces']
hostname = netgraph._node[host]['label']
ospf_confs[host] = (build_ospf_conf_for_host(ipaddress.ip_address(host), hostname, interfaces))
ospf_confs[host] = build_ospf_conf_for_host(ipaddress.ip_address(host), hostname, interfaces)
return ospf_confs
......@@ -116,22 +116,21 @@ def configure_nodes(netgraph):
:param netgraph: networkx graph object representing the network
:return: None
sessions = []
ospf_push_commands = []
ospf_enable_commands = []
hosts = [host for host in netgraph.nodes]
sessions = [session for session in map(lambda host : netgraph._node[host]['session'], hosts)]
ospf_confs = build_ospf_confs_for_network(netgraph)
# Push ospf6d configurations to all nodes
for host in hosts:
push_command = CONFIG_PUSH_COMMAND_TEMPLATE.format(
ssh_helper.run_commands_on_many_hosts(sessions, ospf_push_commands)
outputs = ssh_helper.run_commands_on_many_hosts(sessions, ospf_push_commands)
# Enable ospf6d
for host in hosts:
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment