本文整理匯總了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])