Commit 6bb91967 authored by Simon Redman's avatar Simon Redman

Add one-stop-shop script to configure all nodes

parent 24623d23
#!/usr/bin/env python3
# Copyright (C) 2018 Simon Redman <sredman@cs.utah.edu>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# For future reference, here is the OSPFv6 RFC: https://tools.ietf.org/html/rfc2740.html
import add_routable_ipv6_addrs
import frr_configurator
import ssh_helper
import topomap_parser
import argparse
import getpass
from netdiff import NetJsonParser
if __name__ == "__main__":
parser = argparse.ArgumentParser("Setup an Emulab experiment for Segment Routing")
parser.add_argument("--topomap-file", action='store', default='/var/emulab/boot/topomap', type=str,
help="Path to the emulab topomap file to parse")
parser.add_argument("--netgraph-file", action='store', type=str, required=False,
help="Path to the NetJSON file to parse. Skips parsing the netgrap from the topomap-file")
parser.add_argument("--username", action='store', type=str, default=getpass.getuser(),
help="Username to use on all hosts. Defaults to current user's username")
parser.add_argument("--stop", action='store', type=bool, default=False,
help="Stop all services (after writing config files)")
args = parser.parse_args()
if not args.netgraph_file:
netgraph = NetJsonParser(data=topomap_parser.parse_topomap_to_netjson(args.topomap_file))
else:
netgraph = NetJsonParser(file=args.netgraph_file)
ssh_helper.network_graph_login(netgraph.graph, args.username)
# Skip adding ipv6 addresses to the management interfaces
management_ips = [node["management-ip"] for node in netgraph.graph._node.values()]
ULA_map = add_routable_ipv6_addrs.construct_ULAs(netgraph.graph, ignore_addrs=management_ips)
add_routable_ipv6_addrs.add_ULAs_to_hosts(netgraph.graph, ULA_map)
add_routable_ipv6_addrs.add_interfaces_to_netgraph(netgraph.graph, ULA_map)
frr_configurator.configure_nodes(netgraph.graph)
frr_configurator.start_frr_on_network(netgraph.graph)
ssh_helper.network_graph_logout(netgraph.graph)
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