本文整理汇总了Python中setools.NodeconQuery.results方法的典型用法代码示例。如果您正苦于以下问题:Python NodeconQuery.results方法的具体用法?Python NodeconQuery.results怎么用?Python NodeconQuery.results使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setools.NodeconQuery
的用法示例。
在下文中一共展示了NodeconQuery.results方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_000_unset
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_000_unset(self):
"""Nodecon query with no criteria"""
# query with no parameters gets all nodecons.
nodecons = sorted(self.p.nodecons())
q = NodeconQuery(self.p)
q_nodecons = sorted(q.results())
self.assertListEqual(nodecons, q_nodecons)
示例2: test_053_range_superset1
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_053_range_superset1(self):
"""Nodecon query with context range superset match"""
q = NodeconQuery(self.p, range_="s3 - s3:c0.c4", range_superset=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.53.1"], nodecons)
示例3: test_050_range_exact
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_050_range_exact(self):
"""Nodecon query with context range exact match"""
q = NodeconQuery(self.p, range_="s0:c1 - s0:c0.c4")
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv4Network("10.1.50.1/32")], nodecons)
示例4: test_040_type_exact
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_040_type_exact(self):
"""Nodecon query with context type exact match"""
q = NodeconQuery(self.p, type_="type40", type_regex=False)
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv4Network("10.1.40.1/32")], nodecons)
示例5: test_030_role_exact
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_030_role_exact(self):
"""Nodecon query with context role exact match"""
q = NodeconQuery(self.p, role="role30_r", role_regex=False)
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv4Network("10.1.30.1/32")], nodecons)
示例6: test_020_user_exact
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_020_user_exact(self):
"""Nodecon query with context user exact match"""
q = NodeconQuery(self.p, user="user20", user_regex=False)
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv4Network("10.1.20.1/32")], nodecons)
示例7: test_110_v6network_equal
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_110_v6network_equal(self):
"""Nodecon query with IPv6 equal network"""
q = NodeconQuery(self.p, network="1100::/16", network_overlap=False)
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv6Network("1100::/16")], nodecons)
示例8: test_021_user_regex
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_021_user_regex(self):
"""Nodecon query with context user regex match"""
q = NodeconQuery(self.p, user="user21(a|b)", user_regex=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.21.1", "10.1.21.2"], nodecons)
示例9: test_031_role_regex
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_031_role_regex(self):
"""Nodecon query with context role regex match"""
q = NodeconQuery(self.p, role="role31(a|c)_r", role_regex=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.31.1", "10.1.31.3"], nodecons)
示例10: test_101_v4network_overlap
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_101_v4network_overlap(self):
"""Nodecon query with IPv4 network overlap"""
q = NodeconQuery(self.p, network="10.1.101.128/25", network_overlap=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.101.0"], nodecons)
示例11: test_001_ip_version
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_001_ip_version(self):
"""Nodecon query with IP version match."""
q = NodeconQuery(self.p, ip_version=AF_INET6)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["1100::", "1110::"], nodecons)
示例12: test_100_v4network_equal
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_100_v4network_equal(self):
"""Nodecon query with IPv4 equal network"""
q = NodeconQuery(self.p, network="10.1.100.0/24", network_overlap=False)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.100.0"], nodecons)
示例13: test_055_range_proper_superset3
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_055_range_proper_superset3(self):
"""Nodecon query with context range proper superset match (equal low)"""
q = NodeconQuery(self.p, range_="s5:c1 - s5:c1.c4", range_superset=True, range_proper=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.55.1"], nodecons)
示例14: test_054_range_proper_subset4
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_054_range_proper_subset4(self):
"""Nodecon query with context range proper subset match (equal high only)"""
q = NodeconQuery(self.p, range_="s4:c1,c2 - s4:c1.c3", range_subset=True, range_proper=True)
nodecons = sorted(n.address for n in q.results())
self.assertListEqual(["10.1.54.1"], nodecons)
示例15: test_100_v4network_equal
# 需要导入模块: from setools import NodeconQuery [as 别名]
# 或者: from setools.NodeconQuery import results [as 别名]
def test_100_v4network_equal(self):
"""Nodecon query with IPv4 equal network"""
q = NodeconQuery(self.p, network="192.168.1.0/24", network_overlap=False)
nodecons = sorted(n.network for n in q.results())
self.assertListEqual([IPv4Network("192.168.1.0/24")], nodecons)