本文整理汇总了Python中neutron.agent.linux.ip_lib.get_routing_table函数的典型用法代码示例。如果您正苦于以下问题:Python get_routing_table函数的具体用法?Python get_routing_table怎么用?Python get_routing_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_routing_table函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _assert_extra_routes
def _assert_extra_routes(self, router):
routes = ip_lib.get_routing_table(self.root_helper, router.ns_name)
routes = [{'nexthop': route['nexthop'],
'destination': route['destination']} for route in routes]
for extra_route in router.router['routes']:
self.assertIn(extra_route, routes)
开发者ID:noironetworks,项目名称:neutron2,代码行数:7,代码来源:test_l3_agent.py
示例2: _assert_extra_routes
def _assert_extra_routes(self, router, namespace=None):
if namespace is None:
namespace = router.ns_name
routes = ip_lib.get_routing_table(4, namespace=namespace)
routes = [{'nexthop': route['nexthop'],
'destination': route['destination']} for route in routes]
for extra_route in router.router['routes']:
self.assertIn(extra_route, routes)
开发者ID:openstack,项目名称:neutron,代码行数:9,代码来源:framework.py
示例3: _assert_onlink_subnet_routes
def _assert_onlink_subnet_routes(
self, router, ip_versions, namespace=None):
ns_name = namespace or router.ns_name
routes = []
for ip_version in ip_versions:
_routes = ip_lib.get_routing_table(ip_version,
namespace=ns_name)
routes.extend(_routes)
routes = set(route['destination'] for route in routes)
extra_subnets = router.get_ex_gw_port()['extra_subnets']
for extra_subnet in (route['cidr'] for route in extra_subnets):
self.assertIn(extra_subnet, routes)
开发者ID:openstack,项目名称:neutron,代码行数:12,代码来源:framework.py
示例4: test_get_routing_table
def test_get_routing_table(self):
attr = self.generate_device_details(
ip_cidrs=["%s/24" % TEST_IP, "fd00::1/64"]
)
device = self.manage_device(attr)
device_ip = attr.ip_cidrs[0].split('/')[0]
destination = '8.8.8.0/24'
device.route.add_route(destination, device_ip)
destination6 = 'fd01::/64'
device.route.add_route(destination6, "fd00::2")
expected_routes = [{'nexthop': device_ip,
'device': attr.name,
'destination': destination,
'scope': 'universe'},
{'nexthop': None,
'device': attr.name,
'destination': str(
netaddr.IPNetwork(attr.ip_cidrs[0]).cidr),
'scope': 'link'}]
routes = ip_lib.get_routing_table(4, namespace=attr.namespace)
self.assertItemsEqual(expected_routes, routes)
self.assertIsInstance(routes, list)
expected_routes6 = [{'nexthop': "fd00::2",
'device': attr.name,
'destination': destination6,
'scope': 'universe'},
{'nexthop': None,
'device': attr.name,
'destination': str(
netaddr.IPNetwork(attr.ip_cidrs[1]).cidr),
'scope': 'universe'}]
routes6 = ip_lib.get_routing_table(6, namespace=attr.namespace)
self.assertItemsEqual(expected_routes6, routes6)
self.assertIsInstance(routes6, list)
开发者ID:igordcard,项目名称:neutron,代码行数:38,代码来源:test_ip_lib.py
示例5: test_get_routing_table
def test_get_routing_table(self):
attr = self.generate_device_details()
device = self.manage_device(attr)
device_ip = attr.ip_cidrs[0].split('/')[0]
destination = '8.8.8.0/24'
device.route.add_route(destination, device_ip)
expected_routes = [{'nexthop': device_ip,
'device': attr.name,
'destination': destination},
{'nexthop': None,
'device': attr.name,
'destination': str(
netaddr.IPNetwork(attr.ip_cidrs[0]).cidr)}]
routes = ip_lib.get_routing_table(namespace=attr.namespace)
self.assertEqual(expected_routes, routes)
开发者ID:kodarkI,项目名称:neutron,代码行数:17,代码来源:test_ip_lib.py
示例6: test_get_routing_table
def test_get_routing_table(self):
attr = self.generate_device_details()
device = self.manage_device(attr)
device_ip = attr.ip_cidrs[0].split("/")[0]
destination = "8.8.8.0/24"
device.route.add_route(destination, device_ip)
expected_routes = [
{"nexthop": device_ip, "device": attr.name, "destination": destination, "scope": None},
{
"nexthop": None,
"device": attr.name,
"destination": str(netaddr.IPNetwork(attr.ip_cidrs[0]).cidr),
"scope": "link",
},
]
routes = ip_lib.get_routing_table(4, namespace=attr.namespace)
self.assertEqual(expected_routes, routes)
开发者ID:davidcusatis,项目名称:neutron,代码行数:19,代码来源:test_ip_lib.py
示例7: test_get_routing_table_no_namespace
def test_get_routing_table_no_namespace(self):
with testtools.ExpectedException(ip_lib.NetworkNamespaceNotFound):
ip_lib.get_routing_table(4, namespace="nonexistent-netns")
开发者ID:igordcard,项目名称:neutron,代码行数:3,代码来源:test_ip_lib.py
注:本文中的neutron.agent.linux.ip_lib.get_routing_table函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论