本文整理汇总了Python中AutoNetkit.get_dns_auth_graph方法的典型用法代码示例。如果您正苦于以下问题:Python AutoNetkit.get_dns_auth_graph方法的具体用法?Python AutoNetkit.get_dns_auth_graph怎么用?Python AutoNetkit.get_dns_auth_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoNetkit
的用法示例。
在下文中一共展示了AutoNetkit.get_dns_auth_graph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jsplot
# 需要导入模块: import AutoNetkit [as 别名]
# 或者: from AutoNetkit import get_dns_auth_graph [as 别名]
#.........这里部分代码省略.........
ibgp_filename = os.path.join(jsplot_dir, "ibgp.js")
js_files.append("ibgp.js")
with open( ibgp_filename, 'w') as f_js:
f_js.write( js_template.render(
node_list = node_list,
edge_list = edge_list,
physical_graph = True,
))
#TODO: clarify difference of physical_graph and overlay_graph
#TODO: see if js_files ever used
dns_graph = ank.get_dns_graph(network)
node_list = []
for node in dns_graph.nodes():
# Set label to be FQDN, so don't have multiple "Router A" nodes etc
data = { 'label': "%s (%s)" % (node.fqdn, dns_graph.node[node].get("level"))}
node_list.append( (node.fqdn, data))
dns_filename = os.path.join(jsplot_dir, "dns.js")
edge_list = dns_graph.edges(data=True)
#edge_list = list( (src.fqdn, dst.fqdn, data.get('dns_dir')) for (src, dst, data) in edge_list)
edge_list = list( (src.fqdn, dst.fqdn, '') for (src, dst, data) in edge_list)
js_files.append("dns.js")
with open( dns_filename, 'w') as f_js:
f_js.write( js_template.render(
node_list = node_list,
edge_list = edge_list,
physical_graph = True,
))
dns_auth_graph = ank.get_dns_auth_graph(network)
node_list = []
for node in dns_auth_graph.nodes():
# Set label to be FQDN, so don't have multiple "Router A" nodes etc
data = { 'label': "%s" % node.label}
node_list.append( (node.fqdn, data))
dns_filename = os.path.join(jsplot_dir, "dns_auth.js")
edge_list = dns_auth_graph.edges(data=True)
edge_list = list( (src.fqdn, dst.fqdn, data) for (src, dst, data) in edge_list)
js_files.append("dns_auth.js")
with open( dns_filename, 'w') as f_js:
f_js.write( js_template.render(
node_list = node_list,
edge_list = edge_list,
physical_graph = True,
))
#TODO: add timestamps to plots
# put html file in main plot directory
#TODO: parameterised/variable the css location
plot_width = config.settings['Plotting']['jsplot width']
plot_height = config.settings['Plotting']['jsplot height']
html_filename = os.path.join(plot_dir, "plot.html")
with open( html_filename, 'w') as f_html:
f_html.write( html_template.render( js_file = "main.js",
timestamp=timestamp,
plot_width = plot_width,
plot_height = plot_height,
title = "Physical Network",
css_filename = "./ank_style.css",))
html_filename = os.path.join(plot_dir, "ip.html")
with open( html_filename, 'w') as f_html: