利用python生成交换机的VRF配置文件-创新互联
为了快速生成有规律的VRF,写了一个python脚本,可以快速生成如下的VRF配置。
网页题目:利用python生成交换机的VRF配置文件-创新互联
网址分享:http://scyanting.com/article/iieip.html
ip vpn-instance vpn0
ipv4-family
route-distinguisher 600:600
vpn-target 600:600 both
quit
quit
#!/usr/bin/python2.7def main():
f= open('./vrf.txt', 'w')
for i in range(0,500):
vrf= "vpn"+str(i)
vlan= 600 + i
f.write("ip vpn-instance" + vrf + "
")
f.write("ipv4-family" + "
")
f.write("route-distinguisher" + str(vlan) + ":" + str(vlan) + "
")
f.write("vpn-target" + str(vlan) + ":" + str(vlan) + " both
")
f.write("quit" + "
")
f.write("quit" + "
")
f.write("
")
f.close()
if __name__ == '__main__':
main()
运行后可以理解生成vrf.txt文件。
网页题目:利用python生成交换机的VRF配置文件-创新互联
网址分享:http://scyanting.com/article/iieip.html