scion_topology_graphviz.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:scion-web 作者: netsec-ethz 项目源码 文件源码
def main():
    """
    Draws the topology of the SCION network in a gen folder.
    example: python scion_topology_graph -g "gen", -e, -n:
    will place a pdf file of the scion topology with edge and node labels
    into output/scion_topo.gv
    -g: path to the gen folder ex: SCION/gen
    -e: set this flag if edge labels should be drawn
    -n: set this flag if node labels should be drawn
    -o: path to the output file ex: output/scion_topo.gv
    """
    parser = argparse.ArgumentParser()
    parser.add_argument('-g', '--gen_folder_path', default="gen",
                        help='path to the gen folder')
    parser.add_argument('-e', '--edge_labels', action='store_true', default=False,
                        help='set this flag if you want edge labels')
    parser.add_argument('-n', '--node_labels', action='store_true', default=False,
                        help='set this flag if you want node labels')
    parser.add_argument('-o', '--output_path', default="output/scion_topo.gv",
                        help='path to the output topology file')
    args = parser.parse_args()
    topo = parse_gen_folder(args.gen_folder_path)
    dot = draw_SCION_topology(topo, args.node_labels, args.edge_labels)
    s = Source(dot, filename=dot.filename, format="pdf")
    s.render(directory=args.output_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号