当前位置: 首页>>代码示例>>Python>>正文


Python GoBGPContainer.add_peer方法代码示例

本文整理汇总了Python中lib.gobgp.GoBGPContainer.add_peer方法的典型用法代码示例。如果您正苦于以下问题:Python GoBGPContainer.add_peer方法的具体用法?Python GoBGPContainer.add_peer怎么用?Python GoBGPContainer.add_peer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.gobgp.GoBGPContainer的用法示例。


在下文中一共展示了GoBGPContainer.add_peer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        e1 = ExaBGPContainer(name='e1', asn=65002, router_id='192.168.0.3')

        ctns = [g1, g2, e1]
        cls.clients = {cli.name: cli for cli in (g2, e1)}

        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        for cli in cls.clients.values():
            # Omit "passwd" to avoid a issue on ExaBGP version 4.0.5:
            # https://github.com/Exa-Networks/exabgp/issues/766
            g1.add_peer(cli, is_rs_client=True, passive=True, prefix_limit=10)
            cli.add_peer(g1)

        # advertise a route from route-server-clients
        g2.add_route('10.0.0.0/24')
        e1.add_route('10.0.1.0/24')

        cls.gobgp = g1
开发者ID:sapcc,项目名称:kube-parrot,代码行数:30,代码来源:route_server_test2.py

示例2: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        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)
        g4 = GoBGPContainer(name='g4', asn=65003, router_id='192.168.0.4',
                            ctn_image_name=gobgp_ctn_image_name,
                            log_level=parser_option.gobgp_log_level)
        ctns = [g1, g2, g3, g4]

        # advertise a route from route-server-clients
        cls.clients = {}
        for cli in [g2, g3, g4]:
            cls.clients[cli.name] = cli
        initial_wait_time = max(ctn.run() for ctn in ctns)

        time.sleep(initial_wait_time)

        for cli in cls.clients.itervalues():
            g1.add_peer(cli, is_rs_client=True, passwd='passwd', passive=True, prefix_limit=10)
            cli.add_peer(g1, passwd='passwd')

        cls.gobgp = g1
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:33,代码来源:route_server_softreset_test.py

示例3: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)

        rs_clients = [
            QuaggaBGPContainer(name='q{0}'.format(i + 1), asn=(65001 + i),
                               router_id='192.168.0.{0}'.format(i + 2))
            for i in range(3)]
        ctns = [g1] + rs_clients
        q1 = rs_clients[0]
        q2 = rs_clients[1]
        q3 = rs_clients[2]

        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        for rs_client in rs_clients:
            g1.add_peer(rs_client, is_rs_client=True, passwd='passwd', passive=True, prefix_limit=10)
            rs_client.add_peer(g1, passwd='passwd')

        # advertise a route from route-server-clients
        routes = []
        for idx, rs_client in enumerate(rs_clients):
            route = '10.0.{0}.0/24'.format(idx + 1)
            rs_client.add_route(route)
            routes.append(route)

        cls.gobgp = g1
        cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3}
开发者ID:sapcc,项目名称:kube-parrot,代码行数:35,代码来源:route_server_test.py

示例4: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        g3 = GoBGPContainer(name='g3', asn=65000, router_id='192.168.0.3',
                            ctn_image_name=gobgp_ctn_image_name,
                            log_level=parser_option.gobgp_log_level)
        e1 = ExaBGPContainer(name='e1', asn=65000, router_id='192.168.0.4')

        ctns = [g1, g2, g3, e1]
        initial_wait_time = max(ctn.run() for ctn in ctns)

        time.sleep(initial_wait_time)

        g1.add_peer(e1, addpath=True)
        e1.add_peer(g1, addpath=True)

        g1.add_peer(g2, addpath=False, is_rr_client=True)
        g2.add_peer(g1, addpath=False)

        g1.add_peer(g3, addpath=True, is_rr_client=True)
        g3.add_peer(g1, addpath=True)

        cls.g1 = g1
        cls.g2 = g2
        cls.g3 = g3
        cls.e1 = e1
开发者ID:a16,项目名称:gobgp,代码行数:35,代码来源:addpath_test.py

示例5: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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}
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:34,代码来源:global_policy_test.py

示例6: test_07_mpath_test_setup

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [as 别名]
    def test_07_mpath_test_setup(self):
        g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
                            ctn_image_name=parser_option.gobgp_image,
                            log_level=parser_option.gobgp_log_level,
                            config_format=parser_option.config_format,
                            zebra=True)
        g2 = GoBGPContainer(name='g2', asn=65001, router_id='192.168.0.2',
                            ctn_image_name=parser_option.gobgp_image)
        g3 = GoBGPContainer(name='g3', asn=65001, router_id='192.168.0.3',
                            ctn_image_name=parser_option.gobgp_image)
        g4 = GoBGPContainer(name='g4', asn=65000, router_id='192.168.0.4',
                            ctn_image_name=parser_option.gobgp_image)
        g5 = GoBGPContainer(name='g5', asn=65000, router_id='192.168.0.5',
                            ctn_image_name=parser_option.gobgp_image)

        ctns = [g1, g2, g3, g4, g5]
        for ctn in ctns:
            self.ctns[ctn.name] = ctn

        initial_wait_time = max(ctn.run() for ctn in ctns)

        time.sleep(initial_wait_time)

        # advertise same prefix
        g2.add_route('10.0.10.0/24')
        g3.add_route('10.0.10.0/24')
        g4.add_route('10.0.10.0/24')
        g5.add_route('10.0.10.0/24')

        for g in [g2, g3, g4, g5]:
            g1.add_peer(g)
            g.add_peer(g1)
开发者ID:a16,项目名称:gobgp,代码行数:34,代码来源:bgp_zebra_test.py

示例7: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        q1 = QuaggaBGPContainer(name='q1', asn=65002, router_id='192.168.0.2')
        g2 = GoBGPContainer(name='g2', asn=65001, router_id='192.168.0.3',
                            ctn_image_name=gobgp_ctn_image_name,
                            log_level=parser_option.gobgp_log_level)
        ctns = [g1, g2, q1]

        initial_wait_time = max(ctn.run() for ctn in ctns)

        time.sleep(initial_wait_time)

        g1.add_peer(q1)
        q1.add_peer(g1)

        q1.add_peer(g2)
        g2.add_peer(q1)

        g1.add_route('10.0.0.0/24')

        cls.g1 = g1
        cls.g2 = g2
        cls.q1 = q1
        cls.ctns = {n.name: n for n in ctns}
开发者ID:a16,项目名称:gobgp,代码行数:31,代码来源:aspath_test.py

示例8: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        e1 = ExaBGPContainer(name='e1', asn=65002, router_id='192.168.0.3')
        ctns = [g1, g2, e1]

        # advertise a route from route-server-clients
        cls.clients = {}
        for idx, cli in enumerate((g2, e1)):
            route = '10.0.{0}.0/24'.format(idx)
            cli.add_route(route)
            cls.clients[cli.name] = cli

        initial_wait_time = max(ctn.run() for ctn in ctns)

        time.sleep(initial_wait_time)

        for cli in cls.clients.itervalues():
            g1.add_peer(cli, is_rs_client=True, passwd='passwd', passive=True, prefix_limit=10)
            cli.add_peer(g1, passwd='passwd')

        cls.gobgp = g1
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:31,代码来源:route_server_test2.py

示例9: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        q1 = QuaggaBGPContainer(name='q1', asn=65001, router_id='192.168.0.2')
        q2 = QuaggaBGPContainer(name='q2', asn=65002, router_id='192.168.0.3')
        q3 = QuaggaBGPContainer(name='q3', asn=65003, router_id='192.168.0.4')

        qs = [q1, q2, q3]
        ctns = [g1, q1, q2, q3]

        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        for q in qs:
            g1.add_peer(q, passwd='passwd')
            q.add_peer(g1, passwd='passwd', passive=True)

        # 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)

        cls.gobgp = g1
        cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3}
开发者ID:sapcc,项目名称:kube-parrot,代码行数:30,代码来源:bgp_router_test.py

示例10: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)

        rs_clients = [
            ExaBGPContainer(name='q{0}'.format(i + 1), asn=(65001 + i),
                            router_id='192.168.0.{0}'.format(i + 2))
            for i in range(4)]
        ctns = [g1] + rs_clients

        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        for i, rs_client in enumerate(rs_clients):
            g1.add_peer(rs_client, is_rs_client=True)
            as2 = False
            if i > 1:
                as2 = True
            rs_client.add_peer(g1, as2=as2)

        # advertise a route from route-server-clients
        for idx, rs_client in enumerate(rs_clients):
            route = '10.0.{0}.0/24'.format(idx + 1)
            rs_client.add_route(route)
            if idx < 2:
                route = '10.0.10.0/24'
            rs_client.add_route(route)

        cls.gobgp = g1
        cls.quaggas = {x.name: x for x in rs_clients}
开发者ID:sapcc,项目名称:kube-parrot,代码行数:36,代码来源:route_server_as2_test.py

示例11: test_15_check_active_connection

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [as 别名]
 def test_15_check_active_connection(self):
     g1 = self.gobgp
     g2 = GoBGPContainer(name='g2', asn=65000, router_id='192.168.0.7',
                         ctn_image_name=self.gobgp.image,
                         log_level=parser_option.gobgp_log_level)
     time.sleep(g2.run())
     self.quaggas['g2'] = g2
     g2.add_peer(g1, passive=True)
     g1.add_peer(g2)
     g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g2)
开发者ID:sapcc,项目名称:kube-parrot,代码行数:12,代码来源:bgp_router_test.py

示例12: test_07_check_replace_peer_as

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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])
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:16,代码来源:aspath_test.py

示例13: test_04_add_non_graceful_restart_enabled_peer

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:17,代码来源:graceful_restart_test.py

示例14: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [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)
        e1 = ExaBGPContainer(name='e1', asn=65001, router_id='192.168.0.2')

        ctns = [g1, e1]
        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        g1.add_peer(e1, treat_as_withdraw=True)
        e1.add_peer(g1)

        cls.g1 = g1
        cls.e1 = e1
开发者ID:a16,项目名称:gobgp,代码行数:20,代码来源:bgp_malformed_msg_handling_test.py

示例15: boot

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_peer [as 别名]
    def boot(env):
        gobgp_ctn_image_name = env.parser_option.gobgp_image
        log_level = env.parser_option.gobgp_log_level
        g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
                            ctn_image_name=gobgp_ctn_image_name,
                            log_level=log_level)
        e1 = ExaBGPContainer(name='e1', asn=65001, router_id='192.168.0.2')
        e2 = ExaBGPContainer(name='e2', asn=65001, router_id='192.168.0.2')

        ctns = [g1, e1, e2]
        initial_wait_time = max(ctn.run() for ctn in ctns)
        time.sleep(initial_wait_time)

        for q in [e1, e2]:
            g1.add_peer(q, is_rs_client=True)
            q.add_peer(g1)

        env.g1 = g1
        env.e1 = e1
        env.e2 = e2
开发者ID:a16,项目名称:gobgp,代码行数:22,代码来源:route_server_malformed_test.py


注:本文中的lib.gobgp.GoBGPContainer.add_peer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。