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


Python ip_lib.device_exists_with_ips_and_mac函数代码示例

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


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

示例1: _assert_dvr_floating_ips

    def _assert_dvr_floating_ips(self, router):
        # in the fip namespace:
        # Check that the fg-<port-id> (floatingip_agent_gateway)
        # is created with the ip address of the external gateway port
        floating_ips = router.router[l3_constants.FLOATINGIP_KEY]
        self.assertTrue(floating_ips)
        # We need to fetch the floatingip agent gateway port info
        # from the router_info
        floating_agent_gw_port = (
            router.router[l3_constants.FLOATINGIP_AGENT_INTF_KEY])
        self.assertTrue(floating_agent_gw_port)

        external_gw_port = floating_agent_gw_port[0]
        fip_ns = self.agent.get_fip_ns(floating_ips[0]['floating_network_id'])
        fip_ns_name = fip_ns.get_name()
        fg_port_created_successfully = ip_lib.device_exists_with_ips_and_mac(
            fip_ns.get_ext_device_name(external_gw_port['id']),
            [self._port_first_ip_cidr(external_gw_port)],
            external_gw_port['mac_address'],
            namespace=fip_ns_name)
        self.assertTrue(fg_port_created_successfully)
        # Check fpr-router device has been created
        device_name = fip_ns.get_int_device_name(router.router_id)
        fpr_router_device_created_successfully = ip_lib.device_exists(
            device_name, namespace=fip_ns_name)
        self.assertTrue(fpr_router_device_created_successfully)

        # In the router namespace
        # Check rfp-<router-id> is created correctly
        for fip in floating_ips:
            device_name = fip_ns.get_rtr_ext_device_name(router.router_id)
            self.assertTrue(ip_lib.device_exists(
                device_name, namespace=router.ns_name))
开发者ID:manjeetbhatia,项目名称:test_l3,代码行数:33,代码来源:test_dvr_router.py

示例2: _check_lla_status

 def _check_lla_status(router, expected):
     internal_devices = router.router[l3_constants.INTERFACE_KEY]
     for device in internal_devices:
         lladdr = ip_lib.get_ipv6_lladdr(device['mac_address'])
         exists = ip_lib.device_exists_with_ips_and_mac(
             router.get_internal_device_name(device['id']), [lladdr],
             device['mac_address'], router.ns_name)
         self.assertEqual(expected, exists)
开发者ID:Blahhhhh,项目名称:neutron,代码行数:8,代码来源:test_ha_router.py

示例3: floating_ips_configured

 def floating_ips_configured(self, router):
     floating_ips = router.router[l3_constants.FLOATINGIP_KEY]
     external_port = router.get_ex_gw_port()
     return len(floating_ips) and all(
         ip_lib.device_exists_with_ips_and_mac(
             router.get_external_device_name(external_port['id']),
             ['%s/32' % fip['floating_ip_address']],
             external_port['mac_address'],
             namespace=router.ns_name) for fip in floating_ips)
开发者ID:Akanksha08,项目名称:neutron,代码行数:9,代码来源:test_l3_agent.py

示例4: test_device_exists_with_ips_and_mac

    def test_device_exists_with_ips_and_mac(self):
        attr = self.generate_device_details()
        device = self.manage_device(attr)
        self.assertTrue(ip_lib.device_exists_with_ips_and_mac(*attr))

        wrong_ip_cidr = "10.0.0.1/8"
        wrong_mac_address = "aa:aa:aa:aa:aa:aa"

        attr = self.generate_device_details(name="wrong_name")
        self.assertFalse(ip_lib.device_exists_with_ips_and_mac(*attr))

        attr = self.generate_device_details(ip_cidrs=[wrong_ip_cidr])
        self.assertFalse(ip_lib.device_exists_with_ips_and_mac(*attr))

        attr = self.generate_device_details(mac_address=wrong_mac_address)
        self.assertFalse(ip_lib.device_exists_with_ips_and_mac(*attr))

        attr = self.generate_device_details(namespace="wrong_namespace")
        self.assertFalse(ip_lib.device_exists_with_ips_and_mac(*attr))

        device.link.delete()
开发者ID:davidcusatis,项目名称:neutron,代码行数:21,代码来源:test_ip_lib.py

示例5: device_exists_with_ips_and_mac

 def device_exists_with_ips_and_mac(self, expected_device, name_getter,
                                    namespace):
     ip_cidrs = common_utils.fixed_ip_cidrs(expected_device['fixed_ips'])
     return ip_lib.device_exists_with_ips_and_mac(
         name_getter(expected_device['id']), ip_cidrs,
         expected_device['mac_address'], namespace)
开发者ID:Akanksha08,项目名称:neutron,代码行数:6,代码来源:test_l3_agent.py


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