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文件。