网络工程师编程:使用配置

即使在一个良好的网络中,从设计的角度来看,也有必要不时地进行某些实体的配置更新工作。 在进行此类活动的最引人注目的和最预期的原因中,可以注意到迁移是为了协调物理和逻辑平面,作为技术演进过程的一部分的网络发展,所连接网段的体系结构的协调以及增长问题的解决方案。 实际上,网络的生命周期几乎总是由具有一个或另一个风险级别的变化以及对服务的广泛影响组成,在评估中,人为因素不可忽略。 尽管将这种描述概括为人类活动的大多数领域是非常适当的,但是通信网络的功能具有一些功能,值得理解或至少应注意:-通信网络的各个要素处于紧密的通信中,紧密地相互作用并且不仅直接而且间接地呈现。互相影响。 因此,只有在尽可能减少人为错误可能性的机制的支持下,一项正在进行的工作的有效策略才会变得更有成效。 在“网络工程师为什么要编程”系列的下一篇文章中我将讨论在这样一项任务中使用自动化的选项。

在有关网络体系结构的许多“入门”中,就IGP域的设计而言,术语“大规模网络”和“分层网络”几乎是同义词,表示一种简单且乍一看可以理解的设计-将一个域划分为多个域。 同时,饱和阈值只是一个单独的问题,在某些情况下,一台IGP区域中通常可以共存一千个现代路由器,否则三百个就足以显着降低运行特性。 多数情况下,此阈值由施加在IGP上的协议确定,因此,在未来网络的边界和规模存在某些可变性和不确定性的情况下,行业的``野牛''找到了一种更灵活的方法来构建平坦域,随后将其成形零件迁移到单独的区域中。 换句话说,如果您不能“明天看明天”,请建立一个扁平的网络,并根据收敛时间降低或过度利用复杂性的最初迹象将其拆分,因为没有层次结构仍然比不确定情况下选择错误的层次结构更好结构[1、2、3]。

相当笼统的描述和抽象示例,假设我们正在处理OSPFv2域的一个区域,该区域的物理纤维/通道拓扑已经可以识别非晶结构中未来区域的边界。 我不支持以“全有或全无”的原则来改变某件事,可能会由于不可预见的情况而使机会的空间变得太狭窄,预期的风险也太大了。 更改OSPFv2区域是一项破坏性的操作,因此,迁移过程中最直接的方案是在所有拓扑结构中方便使用,该方案包括沿从未来边界向下的顺序将路由器顺序转移到新区域。 幸运的是,不久前,在有关开发OSPF的建议中,概述了在几个领域建立连接的可能性[4]。 利用这个机会,我们可以将迁移分为三个阶段:

  1. 在新区域中建立其他(辅助)连接
  2. 将新区域转移到主模式,将旧区域转移到其他模式
  3. 删除旧范围内的连接

在第一阶段,新区域的拓扑结构逐渐扩大;在第二阶段,旧区域的拓扑结构变窄。 取决于新旧拓扑的一致性,我们在翻译后的节点和非翻译后的节点之间获得了一致的路由,这又使将阶段划分为独立的子阶段成为可能,在每个阶段都可以使用节点的某些部分来完成。 从特定网络中信道的实际利用的角度出发,建议在子阶段的框架中选择工作节点,以防止在新旧区域的边界重新加载。 尽管该文章专门讨论了编程,但我认为在域变更的情况下对强加给IGP的协议的行为只说几句话并不是多余的。 LDP的行为非常可预测;通过在目标传输地址和接口会话之间提供IP连接,可以实现平滑转换。 由于BGP是一种非常灵活的协议,因此您应该密切注意此平面。 如果BGP不会以“本地首选项”的更改或其他确定节点之间不一致的本地路由决策的标准的形式在转换后的节点上引入特殊的自由,那是很好的。 换句话说,如果区域内的路由选择与遵循的IGP路径规则不冲突,则BGP的行为也是可以预测的。 在两个区域共存的时期,RSVP的工作有一个微妙的地方。 从具有不同可见性的两个来源填充TED表的事实引发了一些思考,例如,您很可能会失去FRR机制,直到工作完成。 如果在两个区域中具有较高可见性的路由器通过具有较低可见性的路由器来计算ERO,即发生ERO,则会发生这种情况。 通过翻译后的网段,而没有有关另一区域的拓扑信息。 这不能称为灾难,因为最终会建立路径,但是您不应忘记它。 特殊技术要求将引入IGP层次结构的工作与在BGP平面中进行的同类工作相结合,例如,通过将全网格迁移到路由反射器中来进行。 在不同平面中引入层次结构最好按顺序进行,在我看来,这同样适用于所有隐藏路由信息的事物,摘要比层次结构IGP的稳定基础更容易建立。

因此,我们有一个总体计划,如果您还没有改变主意,让我们考虑一下Pyez上的软件实现,如图中所示。

图片

每个美丽的椭圆形可以是一个单独的软件实体,即 完成工作并为下一步准备数据的事物。 初始数据意味着来自网络的信息,例如,为了准备新的OSPF区域的配置,您需要获取属于旧区域的活动接口的名称及其权重,这意味着我们将需要使用操作表和视图的技能。 这些概念可以在“网络工程师编程:第一种情况”系列的上一篇文章中找到。 在第一阶段,生成器将激活新区域所需的命令保存在文件中,在第二阶段-删除旧区域并将新模式转移到主模式,在第三阶段-删除旧区域的命令。 展望未来,我会说,在本文中,我故意不使用Jinja2之类的模板可视化工具。 为了不分散目标主题的影响,编写了尽可能简单的代码。 如果有人对链接“ Jinja2文档”上的文档感兴趣。

步骤配置生成代码
import sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) return def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) yml = ''' --- OSPFInterface: rpc: get-ospf-interface-information args: area: '0.0.0.200' detail: True item: ospf-interface view: OSPFInterfaceView OSPFInterfaceView: fields: name: interface-name type: interface-type cost: interface-cost ''' globals().update(FactoryLoader().load(yaml.load(yml))) node_list = ['10.83.20.68', '10.83.20.69', '10.83.20.70', '10.83.20.71'] abr_list = ['10.83.20.66', '10.83.20.67'] for node in node_list + abr_list: ddev = getConnection(node, 'lab') ospf_interfaces = OSPFInterface(ddev).get() with open('st1-' + node + '.txt', "w") as f_st1: for ospf_interface in ospf_interfaces: if ( 'ge' in ospf_interface.name ): f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' secondary' + '\n') f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') with open('st2-' + node + '.txt', "w") as f_st1: f_st1.write('delete protocols ospf area 0.0.0.200' + '\n') f_st1.write('delete protocols ospf area 0.0.0.250' + '\n') for ospf_interface in ospf_interfaces: f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' secondary' + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' interface-type p2p' + '\n') if (ospf_interface.cost != '0'): f_st1.write('set protocols ospf area 0.0.0.250 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') f_st1.write('set protocols ospf area 0.0.0.200 interface ' + ospf_interface.name + ' metric ' + ospf_interface.cost + '\n') with open('st3-' + node + '.txt', "w") as f_st1: f_st1.write('delete protocols ospf area 0.0.0.200' + '\n') 


为了清楚起见,我将这样的网络放在vMX上。

图片

vMX是瞻博网络(Juniper Networks)的功能齐全的软件路由器,在很大程度上重复了其较老的兄弟MX的行为。 并不是说它是一种必须引入的产品,它对于将这些东西方便地用于编程练习或实验室测试非常有用。 可以在此处下载试用版“ vMX试用版下载” ,并在此链接“准备系统以安装vMX”下载安装说明。

路由器bb,abr1和abr2形成零区域,路由器r1,r2,r3和r4-应从第200个区域移至第250个区域。

lab @ bb>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/3.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } } } 



lab @ abr1>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.66; neighbor 10.0.0.65; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface ge-0/0/0.0 { interface-type p2p; } } area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } } } 


lab @ abr2>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.67; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.0 { interface lo0.0 { interface-type p2p; } interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } } area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } } } 



lab @ r1>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.68; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.69; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } } 


lab @ r2>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.69; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.70; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } } 


lab @ r3>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.70; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.71; } } ospf { area 0.0.0.200 { interface ge-0/0/0.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } } 


lab @ r4>显示配置协议
 bgp { group int { type internal; local-address 10.0.0.71; neighbor 10.0.0.65; neighbor 10.0.0.66; neighbor 10.0.0.67; neighbor 10.0.0.68; neighbor 10.0.0.69; neighbor 10.0.0.70; } } ospf { area 0.0.0.200 { interface ge-0/0/1.0 { interface-type p2p; } interface ge-0/0/2.0 { interface-type p2p; } interface ge-0/0/3.0 { interface-type p2p; } interface lo0.0 { interface-type p2p; } } } 


对于r2路由器,将生成以下命令集。

对于第一阶段
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 1.0辅助
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 1.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 1.0公制1
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 2.0辅助
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 2.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 2.0公制1
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 3.0辅助
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 3.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 3.0公制1


第二阶段
删除协议ospf区域0.0.0.200
删除协议ospf区域0.0.0.250
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 1.0接口类型p2p
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 1.0辅助
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 1.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 1.0公制1
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 1.0公制1
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 2.0接口类型p2p
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 2.0辅助
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 2.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 2.0公制1
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 2.0度量标准1
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 3.0接口类型p2p
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 3.0辅助
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 3.0接口类型p2p
设置协议ospf区域0.0.0.250接口ge-0 / 0 / 3.0公制1
设置协议ospf区域0.0.0.200接口ge-0 / 0 / 3.0公制1
设置协议ospf区域0.0.0.250接口lo0.0接口类型p2p
设置协议ospf区域0.0.0.200接口lo0.0辅助
设置协议ospf区域0.0.0.200接口lo0.0接口类型p2p


第三阶段
删除协议ospf区域0.0.0.200


正如我已经写过的,网络的元素具有内部状态,无论它们是否需要,它们周围和内部都会不断发生某些事情。 在工作期间,必须考虑并考虑发生收发器故障,节点断电或光通道中断等事件。 我建议在选择验证迁移阶段是否成功的背景下注意这一事实。 不管这听起来有多矛盾,在这种情况下,我们都不必检查OSPF邻居是否出现在该接口上,因为缺少OSPF的原因可能在完全不同的平面上。 除上述内容外,错误或不准确性总是会进入源数据中,例如,以必须删除的已遗忘接口的形式出现,但当前正在寻找“空”。 在生成检查的过程中,从提供的服务和所施加的协议的角度上一层来看网络是很有用的,因为最终只有这些事情的状态才能使您对特定阶段的成功做出明智的决定。 很少有客户同意基于他们工作成果的公开文章,这就是为什么我将虚拟环境放在一起进行演示的原因。 在这种环境下,我将仅限于检查BGP会话的状态,这些会话是在路由器之间一对一的基础上构建的,这将是我们强加的服务和服务。 如果在工作后以IP连接的形式满足了各自的性能条件,则有理由相信该工作已成功完成。 在实际项目中,检查通常限于所施加的服务和协议的数量,这在给定网络中被指定为关键业务。 但是,这不适用于编程,我只能关注这个问题,因为选择成功标准是完成工作后保持良好睡眠的关键。

BGP会话验证码
 import sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) return def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) ip_f_name = 'ip-list-1.txt' yml = ''' --- BGPGroup: rpc: get-bgp-group-information args: group-name: 'int' item: bgp-group view: BGPGroupView BGPGroupView: fields: count: peer-count established: established-count ''' globals().update(FactoryLoader().load(yaml.load(yml))) node_list = ['10.83.20.68', '10.83.20.69', '10.83.20.70', '10.83.20.71'] abr_list = ['10.83.20.66', '10.83.20.67'] for node in node_list + abr_list: ddev = getConnection(node, 'lab') bgp_group = BGPGroup(ddev).get() for group in bgp_group: if (group.count != group.established): print 'bgp connection lost' else: print 'dont panic!' 


他的工作成果
调试-SSH连接到10.83.20.68
调试-SSH连接建立到主机10.83.20.68
调试-建立名为r1的连接10.83.20.68
不要惊慌!
调试-SSH连接到10.83.20.69
调试-SSH连接建立到主机10.83.20.69
调试-建立名为r2的连接10.83.20.69
不要惊慌!
调试-SSH连接到10.83.20.70
调试-SSH连接建立到主机10.83.20.70
调试-建立名为r3的连接10.83.20.70
不要惊慌!
调试-SSH连接到10.83.20.71
调试-SSH连接建立到主机10.83.20.71
调试-建立名为r4的连接10.83.20.71
不要惊慌!
调试-SSH连接到10.83.20.66
调试-SSH连接建立到主机10.83.20.66
调试-建立名为abr1的连接10.83.20.66
不要惊慌!
调试-SSH连接到10.83.20.67
调试-SSH连接建立到主机10.83.20.67
调试-建立名为abr2的连接10.83.20.67
不要惊慌!

到目前为止,我们主要讨论的是某些网络方面的内容,但是我仍然没有提及有关程序代码的字样,在该名称的文章中,它似乎是关注的焦点。 首先,在我看来,思想比代码重要得多,因为头脑中有了形式化的实体,工程师才能将其变成工具并以代码的形式陈述。 其次,我不想重复我自己,在这些示例中似乎并不明显的所有内容,以及开始使用Python和Pyez所需的最低知识,都包含在本系列的上一篇文章中。 第三,配置准备代码执行其工作,该工作称为脱机并且对网络没有立即影响,因此不太可能引起任何关注。 与实现阶段的实现代码有所不同;这些过程的开发提出了以下问题:

  • 如何检查口译员是否充分理解了命令的全部内容
  • 如何验证对配置所做的更改已应用?
  • 如何实现事务配置方案?
  • 在失去控制的情况下如何回滚配置?
  • 如果解释器在命令传输期间报告错误,该如何清理?

对这些问题的关注越多,执行阶段的惊喜就越少。 想象一下,当解释器仅部分批准该策略的分类器时,语法错误会描述路由策略。 如果不逐行控制此策略与当前配置的合并过程,则可以通过单击按钮将设备堆置于不足的状态。 因此,我大致遵守执行阶段图的这样一个方框。

图片

有了Pyez文档,便编译了以下通用配置加载程序代码,您可以在日常工作中使用它们,就像我在我的使用过程中一样。

conf_change.py
 import sys import yaml from jnpr.junos.factory.factory_loader import FactoryLoader from jnpr.junos import Device from jnpr.junos.utils.config import Config import copy import re import traceback import time import random from jnpr.junos.exception import * import os.path yml = ''' --- VersionInfo: rpc: get-software-information item: software-information view: VersionInfoView VersionInfoView: fields: name: host-name ''' Device.auto_probe = 3 ip_f_name = 'ip-list-1.txt' cur_stage='2' globals().update(FactoryLoader().load(yaml.load(yml))) def doTestOSPF(p_dev, p_node, f_do): print ' DEBUG --- doTestOSPF : at ' + p_node if ( p_dev == None ): print ' DEBUG --- ERROR --- doTestOSPF : connection to ' + p_node + ' is None' return else: try: d_conf = p_dev.cli("show configuration | display set").split('\n') ret_val = True set_found = 0 c_path = 'st' + cur_stage + '-' + p_node + '.txt' with open(c_path, "r") as f: for line in f: c_line = line.replace('\n', '').replace('\r\n', '') if ('delete ' not in c_line): set_found = 1 if ( (c_line not in d_conf) and (c_line != '')): print ' DEBUG --- doTestOSPF found missing line ' + c_line ret_val = False f.close() if ( (set_found == 0) and (f_do == True) ): return False return ret_val except Exception as ex: print ' DEBUG --- ERROR --- doTestOSPF : connection to ' + p_node + ' was not established. ex:' + str(ex) return def doTest(p_dev, p_node, f_do): return doTestOSPF(p_dev, p_node, f_do) def close_dev(d): try: d.close() except Exception as ex: print ' DEBUG --- ERROR --- close_dev : connection to cant be closed. ex:' + str(ex) def getConnection(p_host, p_user): acc = {'lab': 'lab123'} try: print ' DEBUG --- getting ssh connection to ' + p_host l_dev = Device(host=p_host, user=p_user, password=acc[p_user], auto_probe=2, gather_facts=True, port=22) l_dev.open() if (l_dev.connected): l_dev.timeout = 900 print ' DEBUG --- ssh cionnection to host ' + p_host + ' established' v = VersionInfo(l_dev).get() print ' DEBUG --- connection ' + p_host + ' named ' + l_dev.facts['hostname'] + ' established ' return l_dev else: raise Exception(' DEBUG --- ssh connection to ' + p_host + ' was not established') except Exception as ex: print ' DEBUG --- ERROR --- getConnection : connection to ' + p_host + ' was not established. ex:' + str(ex) traceback.print_exc() return def doCompare(p_conf, p_node): try: print ' DEBUG --- doCompare at ' + p_node if ( p_conf.diff() == None ): return False else: return True except Exception as ex: print ' DEBUG --- ERROR --- doCompare : conf.diff at ' + p_node + ' ex:' + str(ex) return def doLoad(p_conf, p_node): try: print ' DEBUG --- doLoad at ' + p_node c_path = 'st' + cur_stage + '-' + p_node + '.txt' if (os.path.isfile(c_path)): p_conf.load(path=c_path, format='set') return True except Exception as ex: print ' DEBUG --- ERROR --- doLoad : cant load config to ' + p_node + ' ex:' + str(ex) return def doRollback(p_conf, p_node, p_r): try: print ' DEBUG --- doRollback at ' + p_node if ( p_conf.rollback(rb_id=p_r) == True ): return True else: return False except Exception as ex: print ' DEBUG --- ERROR --- doRollback : cant rollback config to ' + p_node + ' ex:' + str(ex) return None def doCommitCheck(p_conf, p_node): try: print ' DEBUG --- doCommitCheck at ' + p_node p_conf.commit_check() return True except Exception as ex: print ' DEBUG --- ERROR --- doCommitCheck : cant config commit check config to ' + p_node + ' ex:' + str(ex) return None def doCommit(p_conf, p_node, p_confirm_m=None): try: print ' DEBUG --- doCommit at ' + p_node commit_res = None if (p_confirm_m == None): commit_res = p_conf.commit(timeout=30) else: commit_res = p_conf.commit(confirm=p_confirm_m, timeout=30) if (commit_res == True): return True else: return False except CommitError as c_ex: print ' DEBUG --- ERROR --- doCommit : cant config commit at ' + p_node + ' ex:' + str(c_ex) return None except RpcTimeoutError as t_ex: print ' DEBUG --- ERROR --- doCommit : config was commited at ' + p_node + ' with the following ex:' + str(t_ex) return True def doJob(p_dev, p_node): print ' DEBUG --- doJob at ' + p_node if ( p_dev == None ): print ' DEBUG --- ERROR --- doJob : connection to ' + p_node + ' is None' return else: try: with Config(p_dev) as conf: is_compare = doCompare(conf, node) if ( is_compare == None ): print ' DEBUG --- ERROR --- doJob : at config compare ' + node return if ( is_compare == True ): print ' DEBUG --- ERROR --- doJob : configuration locked at ' + node return False print ' DEBUG --- starting to do config changes at ' + node if ( doLoad(conf, node) != True ): print ' DEBUG --- ERROR --- doJob : conf.load ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after load at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return print ' DEBUG --- commit check at ' + node if (doCommitCheck(conf, node) != True): print ' DEBUG --- ERROR --- doJob : conf.doCommitCheck failed at ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after load at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return commit_m = 5 print ' DEBUG --- commiting changes at ' + node if (doCommit(conf, node, commit_m) != True): print ' DEBUG --- ERROR --- doJob : conf.commit ' + node if ( doCompare(conf, node) != False ): print ' DEBUG --- doJob : doing rollback after commit at ' + node + ' deleting :' + str(conf.diff()) doRollback(conf, node, 0) return True except Exception as ex: print ' DEBUG --- ERROR --- doJob : cant do job ' + node + ' ex:' + str(ex) return node_list = [] result_list = {} with open(ip_f_name, "r") as f_ip: for line in f_ip: c_ip_line = line.replace('\n', '').replace('\r\n', '') if (c_ip_line != ''): node_list.append(c_ip_line) for node in node_list: print 'FLOW -- ************************************ ' print 'FLOW -- checking ' + node result_list.setdefault(node, {}) cur_dev = getConnection(node, 'lab') is_test = doTest(cur_dev, node, True) if( is_test == None): print 'FLOW -- error' result_list.setdefault(node, {}).setdefault('status', 'error') break if( is_test == True): print 'FLOW -- conf exist' result_list.setdefault(node, {}).setdefault('status', 'nn') if( is_test == False): print 'FLOW -- conf not exist, doing change' is_job = doJob(cur_dev, node) if( is_job == None): print 'FLOW -- cant do job at ' + node result_list.setdefault(node, {}).setdefault('status', 'error') break if( is_job == False): print 'FLOW -- cant do job at ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') if( is_job == True): print 'FLOW -- done job at ' + node print 'FLOW -- going sleep at ' + node time.sleep(5) print 'FLOW -- checking job status ' + node cur_dev_confirm = getConnection(node, 'lab') if ( cur_dev_confirm != None ): if (doTest(cur_dev, node, False) == True): print 'FLOW -- commiting the configuration at ' + node if (doCommit(Config(cur_dev_confirm), node) != True): print 'FLOW -- ERROR cant commit the configuration at ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') break else: print 'FLOW -- configuration commited at ' + node result_list.setdefault(node, {}).setdefault('status', 'done') else: print 'FLOW -- ERROR cant find conf after job ' + node result_list.setdefault(node, {}).setdefault('status', 'not_done') close_dev(cur_dev_confirm) else: print 'FLOW -- ERROR cant access ' + node + ' for commiting' result_list.setdefault(node, {}).setdefault('status', 'not_done') close_dev(cur_dev) print result_list 


而他的工作成果分三个阶段

隐藏文字
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface ge-0/0/3.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>
>>>
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/0.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/1.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/2.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 secondary
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface ge-0/0/3.0 metric 1
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.250 interface lo0.0 interface-type p2p
DEBUG --- doTestOSPF found missing line set protocols ospf area 0.0.0.200 interface lo0.0 secondary
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>
==== RESTART: C:\Users\and_andreev\Desktop\tools\lab-case2\conf_change.py ====
FLOW -- ************************************
FLOW -- checking 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.66
DEBUG --- doCompare at 10.83.20.66
DEBUG --- starting to do config changes at 10.83.20.66
DEBUG --- doLoad at 10.83.20.66
DEBUG --- commit check at 10.83.20.66
DEBUG --- doCommitCheck at 10.83.20.66
DEBUG --- commiting changes at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- done job at 10.83.20.66
FLOW -- going sleep at 10.83.20.66
FLOW -- checking job status 10.83.20.66
DEBUG --- getting ssh connection to 10.83.20.66
DEBUG --- ssh cionnection to host 10.83.20.66 established
DEBUG --- connection 10.83.20.66 named abr1 established
DEBUG --- doTestOSPF : at 10.83.20.66
FLOW -- commiting the configuration at 10.83.20.66
DEBUG --- doCommit at 10.83.20.66
FLOW -- configuration commited at 10.83.20.66
FLOW -- ************************************
FLOW -- checking 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.67
DEBUG --- doCompare at 10.83.20.67
DEBUG --- starting to do config changes at 10.83.20.67
DEBUG --- doLoad at 10.83.20.67
DEBUG --- commit check at 10.83.20.67
DEBUG --- doCommitCheck at 10.83.20.67
DEBUG --- commiting changes at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- done job at 10.83.20.67
FLOW -- going sleep at 10.83.20.67
FLOW -- checking job status 10.83.20.67
DEBUG --- getting ssh connection to 10.83.20.67
DEBUG --- ssh cionnection to host 10.83.20.67 established
DEBUG --- connection 10.83.20.67 named abr2 established
DEBUG --- doTestOSPF : at 10.83.20.67
FLOW -- commiting the configuration at 10.83.20.67
DEBUG --- doCommit at 10.83.20.67
FLOW -- configuration commited at 10.83.20.67
FLOW -- ************************************
FLOW -- checking 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.68
DEBUG --- doCompare at 10.83.20.68
DEBUG --- starting to do config changes at 10.83.20.68
DEBUG --- doLoad at 10.83.20.68
DEBUG --- commit check at 10.83.20.68
DEBUG --- doCommitCheck at 10.83.20.68
DEBUG --- commiting changes at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- done job at 10.83.20.68
FLOW -- going sleep at 10.83.20.68
FLOW -- checking job status 10.83.20.68
DEBUG --- getting ssh connection to 10.83.20.68
DEBUG --- ssh cionnection to host 10.83.20.68 established
DEBUG --- connection 10.83.20.68 named r1 established
DEBUG --- doTestOSPF : at 10.83.20.68
FLOW -- commiting the configuration at 10.83.20.68
DEBUG --- doCommit at 10.83.20.68
FLOW -- configuration commited at 10.83.20.68
FLOW -- ************************************
FLOW -- checking 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.69
DEBUG --- doCompare at 10.83.20.69
DEBUG --- starting to do config changes at 10.83.20.69
DEBUG --- doLoad at 10.83.20.69
DEBUG --- commit check at 10.83.20.69
DEBUG --- doCommitCheck at 10.83.20.69
DEBUG --- commiting changes at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- done job at 10.83.20.69
FLOW -- going sleep at 10.83.20.69
FLOW -- checking job status 10.83.20.69
DEBUG --- getting ssh connection to 10.83.20.69
DEBUG --- ssh cionnection to host 10.83.20.69 established
DEBUG --- connection 10.83.20.69 named r2 established
DEBUG --- doTestOSPF : at 10.83.20.69
FLOW -- commiting the configuration at 10.83.20.69
DEBUG --- doCommit at 10.83.20.69
FLOW -- configuration commited at 10.83.20.69
FLOW -- ************************************
FLOW -- checking 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.70
DEBUG --- doCompare at 10.83.20.70
DEBUG --- starting to do config changes at 10.83.20.70
DEBUG --- doLoad at 10.83.20.70
DEBUG --- commit check at 10.83.20.70
DEBUG --- doCommitCheck at 10.83.20.70
DEBUG --- commiting changes at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- done job at 10.83.20.70
FLOW -- going sleep at 10.83.20.70
FLOW -- checking job status 10.83.20.70
DEBUG --- getting ssh connection to 10.83.20.70
DEBUG --- ssh cionnection to host 10.83.20.70 established
DEBUG --- connection 10.83.20.70 named r3 established
DEBUG --- doTestOSPF : at 10.83.20.70
FLOW -- commiting the configuration at 10.83.20.70
DEBUG --- doCommit at 10.83.20.70
FLOW -- configuration commited at 10.83.20.70
FLOW -- ************************************
FLOW -- checking 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- conf not exist, doing change
DEBUG --- doJob at 10.83.20.71
DEBUG --- doCompare at 10.83.20.71
DEBUG --- starting to do config changes at 10.83.20.71
DEBUG --- doLoad at 10.83.20.71
DEBUG --- commit check at 10.83.20.71
DEBUG --- doCommitCheck at 10.83.20.71
DEBUG --- commiting changes at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- done job at 10.83.20.71
FLOW -- going sleep at 10.83.20.71
FLOW -- checking job status 10.83.20.71
DEBUG --- getting ssh connection to 10.83.20.71
DEBUG --- ssh cionnection to host 10.83.20.71 established
DEBUG --- connection 10.83.20.71 named r4 established
DEBUG --- doTestOSPF : at 10.83.20.71
FLOW -- commiting the configuration at 10.83.20.71
DEBUG --- doCommit at 10.83.20.71
FLOW -- configuration commited at 10.83.20.71
{'10.83.20.70': {'status': 'done'}, '10.83.20.71': {'status': 'done'}, '10.83.20.67': {'status': 'done'}, '10.83.20.66': {'status': 'done'}, '10.83.20.69': {'status': 'done'}, '10.83.20.68': {'status': 'done'}}
>>>


  1. 完整的IS-IS路由协议-Hannes Gredler,Walter Goralski
  2. OSPF协议 Internet路由协议剖析-John T. Moy
  3. 网络合并和迁移:Junos的设计和实现-Gonzalo Gomez Herrero,Jan Anton Bernal Van Der Ven
  4. OSPF多区域邻接-tools.ietf.org/html/rfc5185

Source: https://habr.com/ru/post/zh-CN413427/


All Articles