首页 > 代码库 > 生成PW配置和BFD配置

生成PW配置和BFD配置

保存在配置文件中

 

 1 def Main(): 2     buf = ‘‘ 3     f = open(pw.cfg,w) 4     for i in range(2016): 5         pwid = str(102 + i) 6         buf +=  "interface gigabitethernet 0/1/2/7."+pwid + \r\n 7         buf +=  "l2transport\r\n" 8         buf +=  mpls l2-circuit pw +pwid +   + pwid +  2.2.2.2 control-word bfd encapsulation raw\r\n 9         buf +=  exit\r\n10     f.writelines(buf)11     f.close()12         13 def create_bfd():14     15     buf = ‘‘16     f = open(bfd.cfg,w)17     for i in range(2016):18         pwid = str(102 + i)19         # mpls static-bfd pw-name pw21 local-discriminator 3 remote-discriminator 3 bind-bfd tp1 20         buf +=  mpls static-bfd pw-name pw+pwid+ local-discriminator +pwid  +  remote-discriminator  + pwid + \r\n21         22     f.writelines(buf)23     f.close()24 if __name__ == __main__:25     create_bfd()26     Main()

 

生成PW配置和BFD配置