• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python framework.get_ovs_bridge函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.tests.functional.agent.l3.framework.get_ovs_bridge函数的典型用法代码示例。如果您正苦于以下问题:Python get_ovs_bridge函数的具体用法?Python get_ovs_bridge怎么用?Python get_ovs_bridge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_fip_connection_for_address_scope

    def test_fip_connection_for_address_scope(self):
        self.agent.conf.agent_mode = 'dvr_snat'
        (machine_same_scope, machine_diff_scope,
            router) = self._setup_address_scope('scope1', 'scope2', 'scope1')

        router.router[l3_constants.FLOATINGIP_KEY] = []
        fip_same_scope = '19.4.4.10'
        self._add_fip(router, fip_same_scope,
                      fixed_address=machine_same_scope.ip,
                      host=self.agent.conf.host,
                      fixed_ip_address_scope='scope1')
        fip_diff_scope = '19.4.4.11'
        self._add_fip(router, fip_diff_scope,
                      fixed_address=machine_diff_scope.ip,
                      host=self.agent.conf.host,
                      fixed_ip_address_scope='scope2')
        router.process(self.agent)

        br_ex = framework.get_ovs_bridge(
            self.agent.conf.external_network_bridge)
        src_machine = self.useFixture(
            machine_fixtures.FakeMachine(br_ex, '19.4.4.12/24'))
        # Floating ip should work no matter of address scope
        net_helpers.assert_ping(src_machine.namespace, fip_same_scope, 5)
        net_helpers.assert_ping(src_machine.namespace, fip_diff_scope, 5)
开发者ID:suda999,项目名称:neutron,代码行数:25,代码来源:test_dvr_router.py


示例2: test_fip_connection_from_same_subnet

    def test_fip_connection_from_same_subnet(self):
        '''Test connection to floatingip which is associated with
           fixed_ip on the same subnet of the source fixed_ip.
           In other words it confirms that return packets surely
           go through the router.
        '''
        router_info = self.generate_router_info(enable_ha=False)
        router = self.manage_router(self.agent, router_info)
        router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
        router_ip = router_ip_cidr.partition('/')[0]

        br_int = framework.get_ovs_bridge(
            self.agent.conf.ovs_integration_bridge)

        src_machine, dst_machine = self.useFixture(
            machine_fixtures.PeerMachines(
                br_int,
                net_helpers.increment_ip_cidr(router_ip_cidr),
                router_ip)).machines

        dst_fip = '19.4.4.10'
        router.router[l3_constants.FLOATINGIP_KEY] = []
        self._add_fip(router, dst_fip, fixed_address=dst_machine.ip)
        router.process(self.agent)

        protocol_port = net_helpers.get_free_namespace_port(
            l3_constants.PROTO_NAME_TCP, dst_machine.namespace)
        # client sends to fip
        netcat = net_helpers.NetcatTester(
            src_machine.namespace, dst_machine.namespace,
            dst_fip, protocol_port,
            protocol=net_helpers.NetcatTester.TCP)
        self.addCleanup(netcat.stop_processes)
        self.assertTrue(netcat.test_connectivity())
开发者ID:tidatida,项目名称:neutron,代码行数:34,代码来源:test_legacy_router.py


示例3: _setup_address_scope

    def _setup_address_scope(self, internal_address_scope1,
                             internal_address_scope2, gw_address_scope=None):
        router_info = self.generate_router_info(enable_ha=False,
                                                num_internal_ports=2)
        address_scope1 = {l3_constants.IP_VERSION_4: internal_address_scope1}
        address_scope2 = {l3_constants.IP_VERSION_4: internal_address_scope2}
        if gw_address_scope:
            router_info['gw_port']['address_scopes'] = {
                l3_constants.IP_VERSION_4: gw_address_scope}
        router_info[l3_constants.INTERFACE_KEY][0]['address_scopes'] = (
            address_scope1)
        router_info[l3_constants.INTERFACE_KEY][1]['address_scopes'] = (
            address_scope2)

        router = self.manage_router(self.agent, router_info)
        router_ip_cidr1 = self._port_first_ip_cidr(router.internal_ports[0])
        router_ip1 = router_ip_cidr1.partition('/')[0]
        router_ip_cidr2 = self._port_first_ip_cidr(router.internal_ports[1])
        router_ip2 = router_ip_cidr2.partition('/')[0]

        br_int = framework.get_ovs_bridge(
            self.agent.conf.ovs_integration_bridge)
        test_machine1 = self.useFixture(
            machine_fixtures.FakeMachine(
                br_int,
                net_helpers.increment_ip_cidr(router_ip_cidr1),
                router_ip1))
        test_machine2 = self.useFixture(
            machine_fixtures.FakeMachine(
                br_int,
                net_helpers.increment_ip_cidr(router_ip_cidr2),
                router_ip2))

        return test_machine1, test_machine2, router
开发者ID:danielmellado,项目名称:neutron,代码行数:34,代码来源:test_legacy_router.py


示例4: _setup_address_scope

    def _setup_address_scope(self, internal_address_scope1, internal_address_scope2, gw_address_scope=None):
        router_info = self.generate_dvr_router_info(enable_snat=True)
        address_scope1 = {str(l3_constants.IP_VERSION_4): internal_address_scope1}
        address_scope2 = {str(l3_constants.IP_VERSION_4): internal_address_scope2}
        if gw_address_scope:
            router_info["gw_port"]["address_scopes"] = {str(l3_constants.IP_VERSION_4): gw_address_scope}
        router_info[l3_constants.INTERFACE_KEY][0]["address_scopes"] = address_scope1
        router_info[l3_constants.INTERFACE_KEY][1]["address_scopes"] = address_scope2
        # Renew the address scope
        router_info[l3_constants.SNAT_ROUTER_INTF_KEY] = []
        self._add_snat_port_info_to_router(router_info, router_info[l3_constants.INTERFACE_KEY])

        router = self.manage_router(self.agent, router_info)
        router_ip_cidr1 = self._port_first_ip_cidr(router.internal_ports[0])
        router_ip1 = router_ip_cidr1.partition("/")[0]
        router_ip_cidr2 = self._port_first_ip_cidr(router.internal_ports[1])
        router_ip2 = router_ip_cidr2.partition("/")[0]

        br_int = framework.get_ovs_bridge(self.agent.conf.ovs_integration_bridge)
        test_machine1 = self.useFixture(
            machine_fixtures.FakeMachine(br_int, net_helpers.increment_ip_cidr(router_ip_cidr1, 10), router_ip1)
        )
        test_machine2 = self.useFixture(
            machine_fixtures.FakeMachine(br_int, net_helpers.increment_ip_cidr(router_ip_cidr2, 10), router_ip2)
        )

        return test_machine1, test_machine2, router
开发者ID:klmitch,项目名称:neutron,代码行数:27,代码来源:test_dvr_router.py


示例5: test_access_to_metadata_proxy

    def test_access_to_metadata_proxy(self):
        """Test access to the l3-agent metadata proxy.

        The test creates:
         * A l3-agent metadata service:
           * A router (which creates a metadata proxy in the router namespace),
           * A fake metadata server
         * A "client" namespace (simulating a vm) with a port on router
           internal subnet.

        The test queries from the "client" namespace the metadata proxy on
        http://169.254.169.254 and asserts that the metadata proxy added
        the X-Forwarded-For and X-Neutron-Router-Id headers to the request
        and forwarded the http request to the fake metadata server and the
        response to the "client" namespace.
        """
        router_info = self.generate_router_info(enable_ha=False)
        router = self.manage_router(self.agent, router_info)
        self._create_metadata_fake_server(webob.exc.HTTPOk.code)

        # Create and configure client namespace
        router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
        br_int = framework.get_ovs_bridge(self.agent.conf.ovs_integration_bridge)

        machine = self.useFixture(
            machine_fixtures.FakeMachine(
                br_int, net_helpers.increment_ip_cidr(router_ip_cidr), router_ip_cidr.partition("/")[0]
            )
        )

        # Query metadata proxy
        firstline = self._query_metadata_proxy(machine)

        # Check status code
        self.assertIn(str(webob.exc.HTTPOk.code), firstline.split())
开发者ID:davidcusatis,项目名称:neutron,代码行数:35,代码来源:test_metadata_proxy.py


示例6: test_direct_route_for_address_scope

    def test_direct_route_for_address_scope(self):
        (machine_same_scope, machine_diff_scope, router) = self._setup_address_scope("scope1", "scope2", "scope1")

        gw_port = router.get_ex_gw_port()
        gw_ip = self._port_first_ip_cidr(gw_port).partition("/")[0]
        br_ex = framework.get_ovs_bridge(self.agent.conf.external_network_bridge)

        src_machine = self.useFixture(machine_fixtures.FakeMachine(br_ex, "19.4.4.12/24", gw_ip))
        # For the internal networks that are in the same address scope as
        # external network, they can directly route to external network
        net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip, 5)
        # For the internal networks that are not in the same address scope as
        # external networks. SNAT will be used. Direct route will not work
        # here.
        src_machine.assert_no_ping(machine_diff_scope.ip)
开发者ID:electrocucaracha,项目名称:neutron,代码行数:15,代码来源:test_legacy_router.py


示例7: test_fip_connection_for_address_scope

    def test_fip_connection_for_address_scope(self):
        (machine_same_scope, machine_diff_scope, router) = self._setup_address_scope("scope1", "scope2", "scope1")

        router.router[l3_constants.FLOATINGIP_KEY] = []
        fip_same_scope = "19.4.4.10"
        self._add_fip(router, fip_same_scope, fixed_address=machine_same_scope.ip, fixed_ip_address_scope="scope1")
        fip_diff_scope = "19.4.4.11"
        self._add_fip(router, fip_diff_scope, fixed_address=machine_diff_scope.ip, fixed_ip_address_scope="scope2")
        router.process(self.agent)

        br_ex = framework.get_ovs_bridge(self.agent.conf.external_network_bridge)
        src_machine = self.useFixture(machine_fixtures.FakeMachine(br_ex, "19.4.4.12/24"))
        # Floating ip should work no matter of address scope
        net_helpers.assert_ping(src_machine.namespace, fip_same_scope, 5)
        net_helpers.assert_ping(src_machine.namespace, fip_diff_scope, 5)
开发者ID:electrocucaracha,项目名称:neutron,代码行数:15,代码来源:test_legacy_router.py


示例8: test_ping_floatingip_reply_with_floatingip

    def test_ping_floatingip_reply_with_floatingip(self):
        router_info = self.generate_dvr_router_info()
        router = self.manage_router(self.agent, router_info)
        router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
        router_ip = router_ip_cidr.partition("/")[0]

        br_int = framework.get_ovs_bridge(self.agent.conf.ovs_integration_bridge)

        src_machine, dst_machine = self.useFixture(
            machine_fixtures.PeerMachines(br_int, net_helpers.increment_ip_cidr(router_ip_cidr), router_ip)
        ).machines

        dst_fip = "19.4.4.10"
        router.router[l3_constants.FLOATINGIP_KEY] = []
        self._add_fip(router, dst_fip, fixed_address=dst_machine.ip, host=self.agent.conf.host)
        router.process(self.agent)

        # Verify that the ping replys with fip
        ns_ip_wrapper = ip_lib.IPWrapper(src_machine.namespace)
        result = ns_ip_wrapper.netns.execute(["ping", "-c", 1, "-W", 5, dst_fip])
        self._assert_ping_reply_from_expected_address(result, dst_fip)
开发者ID:klmitch,项目名称:neutron,代码行数:21,代码来源:test_dvr_router.py


示例9: test_fip_connection_for_address_scope

    def test_fip_connection_for_address_scope(self):
        (machine_same_scope, machine_diff_scope,
            router) = self._setup_address_scope('scope1', 'scope2', 'scope1')

        router.router[lib_constants.FLOATINGIP_KEY] = []
        fip_same_scope = '19.4.4.10'
        self._add_fip(router, fip_same_scope,
                      fixed_address=machine_same_scope.ip,
                      fixed_ip_address_scope='scope1')
        fip_diff_scope = '19.4.4.11'
        self._add_fip(router, fip_diff_scope,
                      fixed_address=machine_diff_scope.ip,
                      fixed_ip_address_scope='scope2')
        router.process()

        br_int = framework.get_ovs_bridge(
            self.agent.conf.ovs_integration_bridge)
        src_machine = self.useFixture(
            machine_fixtures.FakeMachine(br_int, '19.4.4.12/24'))
        # Floating ip should work no matter of address scope
        net_helpers.assert_ping(src_machine.namespace, fip_same_scope)
        net_helpers.assert_ping(src_machine.namespace, fip_diff_scope)
开发者ID:openstack,项目名称:neutron,代码行数:22,代码来源:test_legacy_router.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.get_rand_name函数代码示例发布时间:2022-05-27
下一篇:
Python net_helpers.increment_ip_cidr函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap