本文整理汇总了Python中lib.gobgp.GoBGPContainer.get_global_rib方法的典型用法代码示例。如果您正苦于以下问题:Python GoBGPContainer.get_global_rib方法的具体用法?Python GoBGPContainer.get_global_rib怎么用?Python GoBGPContainer.get_global_rib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.gobgp.GoBGPContainer
的用法示例。
在下文中一共展示了GoBGPContainer.get_global_rib方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_07_check_replace_peer_as
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import get_global_rib [as 别名]
def test_07_check_replace_peer_as(self):
g5 = GoBGPContainer(name='g5', asn=100, router_id='192.168.0.6',
ctn_image_name=parser_option.gobgp_image,
log_level=parser_option.gobgp_log_level)
time.sleep(g5.run())
g4 = self.ctns['g4']
g4.add_peer(g5, replace_peer_as=True)
g5.add_peer(g4)
g4.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g5)
time.sleep(1)
self.assertTrue(g5.get_global_rib()[0]['paths'][0]['aspath'] == [200, 200, 200, 200, 200])
示例2: test_04_add_non_graceful_restart_enabled_peer
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import get_global_rib [as 别名]
def test_04_add_non_graceful_restart_enabled_peer(self):
g1 = self.bgpds['g1']
# g2 = self.bgpds['g2']
gobgp_ctn_image_name = parser_option.gobgp_image
g3 = GoBGPContainer(name='g3', asn=65002, router_id='192.168.0.3',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
self.bgpds['g3'] = g3
time.sleep(g3.run())
g3.add_route('10.10.30.0/24')
g1.add_peer(g3)
g3.add_peer(g1)
g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g3)
time.sleep(1)
self.assertTrue(len(g3.get_global_rib('10.10.20.0/24')) == 1)
示例3: test_05_check_remove_private_as_peer_all
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import get_global_rib [as 别名]
def test_05_check_remove_private_as_peer_all(self):
g3 = GoBGPContainer(name='g3', asn=100, router_id='192.168.0.4',
ctn_image_name=parser_option.gobgp_image,
log_level=parser_option.gobgp_log_level)
g4 = GoBGPContainer(name='g4', asn=200, router_id='192.168.0.5',
ctn_image_name=parser_option.gobgp_image,
log_level=parser_option.gobgp_log_level)
time.sleep(max(ctn.run() for ctn in [g3, g4]))
self.ctns['g3'] = g3
self.ctns['g4'] = g4
self.g2.add_peer(g3)
g3.add_peer(self.g2)
g3.add_peer(g4, remove_private_as='all')
g4.add_peer(g3)
self.g2.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g3)
g3.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g4)
time.sleep(1)
self.assertTrue(g4.get_global_rib()[0]['paths'][0]['aspath'] == [100])