本文整理汇总了Python中lib.gobgp.GoBGPContainer.local方法的典型用法代码示例。如果您正苦于以下问题:Python GoBGPContainer.local方法的具体用法?Python GoBGPContainer.local怎么用?Python GoBGPContainer.local使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.gobgp.GoBGPContainer
的用法示例。
在下文中一共展示了GoBGPContainer.local方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format=parser_option.config_format)
q1 = ExaBGPContainer(name='q1', asn=65001, router_id='192.168.0.2')
q2 = ExaBGPContainer(name='q2', asn=65002, router_id='192.168.0.3')
q3 = ExaBGPContainer(name='q3', asn=65003, router_id='192.168.0.4')
qs = [q1, q2, q3]
ctns = [g1, q1, q2, q3]
# advertise a route from q1, q2, q3
for idx, q in enumerate(qs):
route = '10.0.{0}.0/24'.format(idx + 1)
q.add_route(route)
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
g1.local('gobgp global policy export add default reject')
for q in qs:
g1.add_peer(q)
q.add_peer(g1)
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3}
示例2: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65001, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g2 = GoBGPContainer(name='g2', asn=65001, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g3 = GoBGPContainer(name='g3', asn=65001, router_id='192.168.0.3',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g4 = GoBGPContainer(name='g4', asn=65001, router_id='192.168.0.4',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g5 = GoBGPContainer(name='g5', asn=65001, router_id='192.168.0.5',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
ctns = [g1, g2, g3, g4, g5]
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
g3.local("gobgp vrf add red rd 10:10 rt both 10:10")
g3.local("gobgp vrf add blue rd 20:20 rt both 20:20")
g1.add_peer(g3, graceful_restart=True, llgr=True)
g3.add_peer(g1, vrf='red', is_rr_client=True, graceful_restart=True, llgr=True)
g2.add_peer(g3, graceful_restart=True, llgr=True)
g3.add_peer(g2, vrf='red', is_rr_client=True, graceful_restart=True, llgr=True)
g4.add_peer(g3, graceful_restart=True, llgr=True)
g3.add_peer(g4, vrf='blue', is_rr_client=True, graceful_restart=True, llgr=True)
g5.add_peer(g3, graceful_restart=True, llgr=True)
g3.add_peer(g5, vrf='blue', is_rr_client=True, graceful_restart=True, llgr=True)
cls.g1 = g1
cls.g2 = g2
cls.g3 = g3
cls.g4 = g4
cls.g5 = g5
示例3: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
g2 = GoBGPContainer(name='g2', asn=65000, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
ctns = {ctn.name: ctn for ctn in [g1, g2]}
initial_wait_time = max(ctn.run() for ctn in ctns.values())
time.sleep(initial_wait_time)
g1.local("gobgp vrf add vrf1 rd 100:100 rt both 100:100")
g1.local("gobgp vrf add vrf2 rd 200:200 rt both 200:200")
g2.local("gobgp vrf add vrf1 rd 100:100 rt both 100:100")
g2.local("gobgp vrf add vrf3 rd 300:300 rt both 300:300")
g1.local("gobgp vrf vrf1 rib add 10.0.0.0/24")
g1.local("gobgp vrf vrf2 rib add 10.0.0.0/24")
g2.local("gobgp vrf vrf1 rib add 20.0.0.0/24")
g2.local("gobgp vrf vrf3 rib add 20.0.0.0/24")
for a, b in combinations(ctns.values(), 2):
a.add_peer(b, vpn=True, passwd='rtc', graceful_restart=True)
b.add_peer(a, vpn=True, passwd='rtc', graceful_restart=True)
cls.g1 = g1
cls.g2 = g2
cls.ctns = ctns
示例4: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
g2 = GoBGPContainer(name='g2', asn=65001, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
ctns = [g1, g2]
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time + 2)
done = False
def f(ifname, ctn):
out = ctn.local('ip -6 n', capture=True)
l = [line for line in out.split('\n') if ifname in line]
if len(l) == 0:
return False
elif len(l) > 1:
raise Exception('not p2p link')
return 'REACHABLE' in l[0]
for i in range(20):
g1.local('ping6 -c 1 ff02::1%eth0')
g2.local('ping6 -c 1 ff02::1%eth0')
if f('eth0', g1) and f('eth0', g2):
done = True
break
time.sleep(1)
if not done:
raise Exception('timeout')
for a, b in combinations(ctns, 2):
a.add_peer(b, interface='eth0')
b.add_peer(a, interface='eth0')
cls.g1 = g1
cls.g2 = g2
示例5: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
g2 = GoBGPContainer(name='g2', asn=65000, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
ctns = [g1, g2]
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
g1.local("gobgp vrf add vrf1 rd 10:10 rt both 10:10")
g2.local("gobgp vrf add vrf1 rd 10:10 rt both 10:10")
for a, b in combinations(ctns, 2):
a.add_peer(b, vpn=True, passwd='evpn')
b.add_peer(a, vpn=True, passwd='evpn')
cls.g1 = g1
cls.g2 = g2
示例6: test_23_check_withdrawal3
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def test_23_check_withdrawal3(self):
gobgp_ctn_image_name = parser_option.gobgp_image
g1 = self.gobgp
g3 = GoBGPContainer(name='g3', asn=65006, router_id='192.168.0.8',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
g4 = GoBGPContainer(name='g4', asn=65007, router_id='192.168.0.9',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
initial_wait_time = max(ctn.run() for ctn in [g3, g4])
time.sleep(initial_wait_time)
self.quaggas = {'g3': g3, 'g4': g4}
g3.local('gobgp global rib add 50.0.0.0/24')
g1.add_peer(g3, passive=True)
g3.add_peer(g1)
g1.add_peer(g4, passive=True)
g4.add_peer(g1)
self.test_01_neighbor_established()
self.test_02_check_gobgp_global_rib()
g4.local('gobgp global rib add 50.0.0.0/24 med 10')
paths = g1.get_adj_rib_out(g3, '50.0.0.0/24')
self.assertTrue(len(paths) == 0)
paths = g1.get_adj_rib_out(g4, '50.0.0.0/24')
self.assertTrue(len(paths) == 1)
self.assertTrue(paths[0]['source-id'] == '192.168.0.8')
g3.local('gobgp global rib del 50.0.0.0/24')
paths = g1.get_adj_rib_out(g3, '50.0.0.0/24')
self.assertTrue(len(paths) == 1)
self.assertTrue(paths[0]['source-id'] == '192.168.0.9')
paths = g1.get_adj_rib_out(g4, '50.0.0.0/24')
self.assertTrue(len(paths) == 0)
示例7: setUpClass
# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import local [as 别名]
def setUpClass(cls):
gobgp_ctn_image_name = parser_option.gobgp_image
base.TEST_PREFIX = parser_option.test_prefix
g1 = GoBGPContainer(name='g1', asn=65001, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g2 = GoBGPContainer(name='g2', asn=65002, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g3 = GoBGPContainer(name='g3', asn=65003, router_id='192.168.0.3',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g4 = GoBGPContainer(name='g4', asn=65004, router_id='192.168.0.4',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g5 = GoBGPContainer(name='g5', asn=65005, router_id='192.168.0.5',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g6 = GoBGPContainer(name='g6', asn=65006, router_id='192.168.0.6',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
g7 = GoBGPContainer(name='g7', asn=65007, router_id='192.168.0.7',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level,
config_format='yaml')
ctns = [g1, g2, g3, g4, g5, g6, g7]
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
g4.local("gobgp vrf add red rd 10:10 rt both 10:10")
g4.local("gobgp vrf add blue rd 20:20 rt both 20:20")
g5.local("gobgp vrf add red rd 10:10 rt both 10:10")
g5.local("gobgp vrf add blue rd 20:20 rt both 20:20")
g1.add_peer(g4)
g4.add_peer(g1, vrf='red')
g2.add_peer(g4)
g4.add_peer(g2, vrf='red')
g3.add_peer(g4)
g4.add_peer(g3, vrf='blue')
g4.add_peer(g5, vpn=True)
g5.add_peer(g4, vpn=True)
g5.add_peer(g6, vrf='red')
g6.add_peer(g5)
g5.add_peer(g7, vrf='blue')
g7.add_peer(g5)
cls.g1 = g1
cls.g2 = g2
cls.g3 = g3
cls.g4 = g4
cls.g5 = g5
cls.g6 = g6
cls.g7 = g7