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


Python GoBGPContainer.add_route方法代码示例

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


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

示例1: setUpClass

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

示例2: setUpClass

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

示例3: test_07_mpath_test_setup

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

示例4: test_04_add_non_graceful_restart_enabled_peer

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

示例5: setUpClass

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

        g1.add_route('10.10.10.0/24')
        g1.add_route('10.10.20.0/24')

        g1.add_peer(g2, graceful_restart=True)
        g2.add_peer(g1, graceful_restart=True)

        cls.bgpds = {'g1': g1, 'g2': g2}
开发者ID:cherry-hyx,项目名称:kube-router,代码行数:25,代码来源:graceful_restart_test.py

示例6: setUpClass

# 需要导入模块: from lib.gobgp import GoBGPContainer [as 别名]
# 或者: from lib.gobgp.GoBGPContainer import add_route [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=65000, router_id='192.168.0.2')

        ctns = [g1, e1]

        # advertise a route from q1, q2
        matchs = ['destination 10.0.0.0/24', 'source 20.0.0.0/24']
        thens = ['discard']
        e1.add_route(route='flow1', rf='ipv4-flowspec', matchs=matchs, thens=thens)
        matchs2 = ['tcp-flags S', 'protocol ==tcp ==udp', "packet-length '>1000&<2000'", "source-port '!=2&!=22&!=222'"]
        thens2 = ['rate-limit 9600', 'redirect 0.10:100', 'mark 20', 'action sample']
        g1.add_route(route='flow1', rf='ipv4-flowspec', matchs=matchs2, thens=thens2)
        matchs3 = ['destination 2001::/24/10', 'source 2002::/24/15']
        thens3 = ['discard']
        e1.add_route(route='flow2', rf='ipv6-flowspec', matchs=matchs3, thens=thens3)
        matchs4 = ['destination 2001::/24 10', "label '==100'"]
        thens4 = ['discard']
        g1.add_route(route='flow2', rf='ipv6-flowspec', matchs=matchs4, thens=thens4)

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

        time.sleep(initial_wait_time)

        # ibgp peer. loop topology
        for a, b in combinations(ctns, 2):
            a.add_peer(b, flowspec=True)
            b.add_peer(a, flowspec=True)

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


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