本文整理汇总了Python中pyroute2.IPRoute.get_policy_map方法的典型用法代码示例。如果您正苦于以下问题:Python IPRoute.get_policy_map方法的具体用法?Python IPRoute.get_policy_map怎么用?Python IPRoute.get_policy_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyroute2.IPRoute
的用法示例。
在下文中一共展示了IPRoute.get_policy_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestMisc
# 需要导入模块: from pyroute2 import IPRoute [as 别名]
# 或者: from pyroute2.IPRoute import get_policy_map [as 别名]
class TestMisc(object):
def setup(self):
self.ip = IPRoute()
def teardown(self):
self.ip.close()
def test_get_policy_map(self):
assert isinstance(self.ip.get_policy_map(), dict)
def test_register_policy(self):
self.ip.register_policy(100, nlmsg)
self.ip.register_policy({101: nlmsg})
self.ip.register_policy(102, nlmsg)
assert self.ip.get_policy_map()[100] == nlmsg
assert self.ip.get_policy_map(101)[101] == nlmsg
assert self.ip.get_policy_map([102])[102] == nlmsg
self.ip.unregister_policy(100)
self.ip.unregister_policy([101])
self.ip.unregister_policy({102: nlmsg})
assert 100 not in self.ip.get_policy_map()
assert 101 not in self.ip.get_policy_map()
assert 102 not in self.ip.get_policy_map()
def test_addrpool_expand(self):
# see coverage
for i in range(100):
self.ip.get_addr()
def test_nla_compare(self):
lvalue = self.ip.get_links()
rvalue = self.ip.get_links()
assert lvalue is not rvalue
if lvalue == rvalue:
pass
if lvalue != rvalue:
pass
assert lvalue != 42