本文整理汇总了Python中opserver.uveserver.ParallelAggregator.aggregate方法的典型用法代码示例。如果您正苦于以下问题:Python ParallelAggregator.aggregate方法的具体用法?Python ParallelAggregator.aggregate怎么用?Python ParallelAggregator.aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opserver.uveserver.ParallelAggregator
的用法示例。
在下文中一共展示了ParallelAggregator.aggregate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sum_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_sum_agg(self):
logging.info("%%% Running test_sum_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
total_virtual_machines=4
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
total_virtual_machines=7
)
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
total_virtual_machines=11
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
cnt1 = uvetest["abc-corp:vn-00"]['UVEVirtualNetwork'][
'total_virtual_machines']["10.10.10.10"]
self.assertEqual(
cnt1, res['UVEVirtualNetwork']['total_virtual_machines'])
示例2: test_counter_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_counter_agg(self):
logging.info("%%% Running test_counter_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "previous",
in_tpkts=4
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
in_tpkts=7
)
uvevn3 = UVEServer.merge_previous(
uvevn2, "abc-corp:vn-00", "UVEVirtualNetwork", "in_tpkts",
uvevn["abc-corp:vn-00"]['UVEVirtualNetwork']['in_tpkts'][
"previous"])
pa = ParallelAggregator(uvevn3)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "sample",
in_tpkts=15
)
in_tpkts = uvetest["abc-corp:vn-00"][
'UVEVirtualNetwork']['in_tpkts']["sample"]
self.assertEqual(in_tpkts, res['UVEVirtualNetwork']['in_tpkts'])
示例3: test_list_union_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_list_union_agg(self):
logging.info("%%% Running test_list_union_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
connected_networks=["vn-00"],
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
connected_networks=["vn-01", "vn-02", "vn-03"],
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
for elem in res['UVEVirtualNetwork']['connected_networks']['list']:
if elem[0] != '@':
res['UVEVirtualNetwork']['connected_networks'][
'list'][elem] = \
sorted(res['UVEVirtualNetwork'][
'connected_networks']['list'][elem])
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.11",
connected_networks=["vn-00", "vn-01", "vn-02", "vn-03"],
)
cn = uvetest["abc-corp:vn-00"]['UVEVirtualNetwork'][
'connected_networks']["10.10.10.11"]
self.assertEqual(cn, res['UVEVirtualNetwork']['connected_networks'])
示例4: test_map_union_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_map_union_agg(self):
logging.info("%%% Running test_map_union_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
mstr={2:"xxx", 3:"yyy"},
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
mstr={3:"xxx", 4:"yyy"},
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.11",
mstr={"10.10.10.10:2":"xxx", "10.10.10.10:3":"yyy",\
"10.10.10.11:3":"xxx", "10.10.10.11:4":"yyy"}
)
cn = uvetest["abc-corp:vn-00"]['UVEVirtualNetwork'][
'mstr']["10.10.10.11"]
self.assertEqual(sorted(cn['map']['element']),
sorted(res['UVEVirtualNetwork']['mstr']['map']['element']))
示例5: test_union_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_union_agg(self):
print "*** Running test_union_agg ***"
uvevn = MakeUVEVirtualNetwork(None, "abc-corp:vn-00", "10.10.10.10", connected_networks=["vn-00"])
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11", connected_networks=["vn-01", "vn-02", "vn-03"]
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
print json.dumps(res, indent=4, sort_keys=True)
for elem in res["UVEVirtualNetwork"]["connected_networks"]["list"]:
if elem[0] != "@":
res["UVEVirtualNetwork"]["connected_networks"]["list"][elem] = sorted(
res["UVEVirtualNetwork"]["connected_networks"]["list"][elem]
)
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.11", connected_networks=["vn-00", "vn-01", "vn-02", "vn-03"]
)
cn = uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"]["connected_networks"]["10.10.10.11"]
self.assertEqual(cn, res["UVEVirtualNetwork"]["connected_networks"])
示例6: test_append_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_append_agg(self):
logging.info("%%% Running test_append_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
in_stats=[("vn-01", "1000"), ("vn-02", "1800")],
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
in_stats=[("vn-02", "1200"), ("vn-03", "1500")],
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
res['UVEVirtualNetwork']['in_stats']["list"]["VnStats"] = \
sorted(res['UVEVirtualNetwork']['in_stats']["list"]["VnStats"])
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "sample",
in_stats=[("vn-01", "1000"), (
"vn-02", "3000"), ("vn-03", "1500")],
)
uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"]["in_stats"][
"sample"]["list"]["VnStats"] = \
sorted(uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"][
"in_stats"]["sample"]["list"]["VnStats"])
in_stats = uvetest["abc-corp:vn-00"][
"UVEVirtualNetwork"]["in_stats"]["sample"]
self.assertEqual(in_stats, res['UVEVirtualNetwork']['in_stats'])
示例7: test_struct_sum_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_struct_sum_agg(self):
logging.info("%%% Running test_struct_sum_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
ifstats={"name":"foo", "inbytes":4}
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
ifstats={"inbytes":7}
)
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
ifstats={"inbytes":11}
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
cnt1 = uvetest["abc-corp:vn-00"]['UVEVirtualNetwork'][
'ifstats']["10.10.10.10"]
self.assertEqual(
cnt1, res['UVEVirtualNetwork']['ifstats'])
示例8: test_simple
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_simple(self):
logging.info("%%% Running test_simple %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
attached_policies=[
("100", "allow-some"), ("200", "deny-others")],
connected_networks=["vn-01", "vn-02", "vn-03"],
in_stats=[("vn-01", "1000"), ("vn-02", "1800")],
)
pa = ParallelAggregator(uvevn)
res = pa.aggregate("abc-corp:vn-00", False)
logging.info(json.dumps(res, indent=4, sort_keys=True))
示例9: test_sum_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_sum_agg(self):
print "*** Running test_sum_agg ***"
uvevn = MakeUVEVirtualNetwork(None, "abc-corp:vn-00", "10.10.10.10", total_virtual_machines=4)
uvevn2 = MakeUVEVirtualNetwork(uvevn, "abc-corp:vn-00", "10.10.10.11", total_virtual_machines=7)
uvetest = MakeUVEVirtualNetwork(None, "abc-corp:vn-00", "10.10.10.10", total_virtual_machines=11)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
print json.dumps(res, indent=4, sort_keys=True)
cnt1 = uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"]["total_virtual_machines"]["10.10.10.10"]
self.assertEqual(cnt1, res["UVEVirtualNetwork"]["total_virtual_machines"])
示例10: test_append_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_append_agg(self):
print "*** Running test_append_agg ***"
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "previous",
in_stats=[("vn-01", "1000"), ("vn-02", "1800")],
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
in_stats=[("vn-02", "1200"), ("vn-03", "1500")],
)
uveprev = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
in_stats=[("vn-01", "1000"), ("vn-03", "1700")],
)
uvevn3 = UVEServer.merge_previous(
uvevn2, "abc-corp:vn-00", "UVEVirtualNetwork", "in_stats",
uveprev["abc-corp:vn-00"]['UVEVirtualNetwork'][
'in_stats']["10.10.10.10"])
pa = ParallelAggregator(uvevn3)
res = pa.aggregate("abc-corp:vn-00", False)
print json.dumps(res, indent=4, sort_keys=True)
res['UVEVirtualNetwork']['in_stats']["list"]["VnStats"] = \
sorted(res['UVEVirtualNetwork']['in_stats']["list"]["VnStats"])
uvetest = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "sample",
in_stats=[("vn-01", "2000"), (
"vn-02", "3000"), ("vn-03", "3200")],
)
uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"]["in_stats"][
"sample"]["list"]["VnStats"] = \
sorted(uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"][
"in_stats"]["sample"]["list"]["VnStats"])
in_stats = uvetest["abc-corp:vn-00"][
"UVEVirtualNetwork"]["in_stats"]["sample"]
self.assertEqual(in_stats, res['UVEVirtualNetwork']['in_stats'])
示例11: test_default_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_default_agg(self):
print "*** Running test_default_agg ***"
uvevn = MakeUVEVirtualNetwork(
None,
"abc-corp:vn-00",
"10.10.10.10",
attached_policies=[("100", "allow-some"), ("200", "deny-others")],
total_acl_rules=4,
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn,
"abc-corp:vn-00",
"10.10.10.11",
attached_policies=[("100", "allow-some"), ("200", "deny-others")],
total_acl_rules=5,
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
attached_policies = uvevn["abc-corp:vn-00"]["UVEVirtualNetwork"]["attached_policies"]["10.10.10.10"]
self.assertEqual(attached_policies, res["UVEVirtualNetwork"]["attached_policies"][0][0])
self.assertEqual(
sorted(["10.10.10.10", "10.10.10.11"]), sorted(res["UVEVirtualNetwork"]["attached_policies"][0][1:])
)
acl1 = uvevn["abc-corp:vn-00"]["UVEVirtualNetwork"]["total_acl_rules"]["10.10.10.10"]
acl2 = uvevn2["abc-corp:vn-00"]["UVEVirtualNetwork"]["total_acl_rules"]["10.10.10.11"]
self.assertEqual(
sorted([acl1, acl2]),
sorted(
[res["UVEVirtualNetwork"]["total_acl_rules"][0][0], res["UVEVirtualNetwork"]["total_acl_rules"][1][0]]
),
)
self.assertEqual(
sorted(["10.10.10.10", "10.10.10.11"]),
sorted(
[res["UVEVirtualNetwork"]["total_acl_rules"][0][1], res["UVEVirtualNetwork"]["total_acl_rules"][1][1]]
),
)
print json.dumps(res, indent=4, sort_keys=True)
示例12: test_href_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_href_agg(self):
print "*** Running test_href_agg ***"
uvevn = MakeUVEVirtualNetwork(None, "abc-corp:vn-00", "10.10.10.10", ifs=["host1:eth0"])
pa = ParallelAggregator(uvevn, {"ObjectIf": "if"})
res = pa.aggregate("abc-corp:vn-00", True, "127.0.0.1:8081")
print json.dumps(res, indent=4, sort_keys=True)
uvetest = MakeUVEVirtualNetwork(
None,
"abc-corp:vn-00",
"10.10.10.10",
ifs=[{"name": "host1:eth0", "href": "127.0.0.1:8081/analytics/uves/if/host1:eth0?cfilt=mystruct"}],
)
cn = OpServerUtils.uve_attr_flatten(uvetest["abc-corp:vn-00"]["UVEVirtualNetwork"]["ifs"]["10.10.10.10"])
self.assertEqual(cn, res["UVEVirtualNetwork"]["ifs"])
示例13: test_default_agg
# 需要导入模块: from opserver.uveserver import ParallelAggregator [as 别名]
# 或者: from opserver.uveserver.ParallelAggregator import aggregate [as 别名]
def test_default_agg(self):
logging.info("%%% Running test_default_agg %%%")
uvevn = MakeUVEVirtualNetwork(
None, "abc-corp:vn-00", "10.10.10.10",
attached_policies=[
("100", "allow-some"), ("200", "deny-others")],
total_acl_rules=4
)
uvevn2 = MakeUVEVirtualNetwork(
uvevn, "abc-corp:vn-00", "10.10.10.11",
attached_policies=[
("100", "allow-some"), ("200", "deny-others")],
total_acl_rules=5
)
pa = ParallelAggregator(uvevn2)
res = pa.aggregate("abc-corp:vn-00", False)
attached_policies = \
uvevn["abc-corp:vn-00"]['UVEVirtualNetwork'][
'attached_policies']["10.10.10.10"]
self.assertEqual(attached_policies,
res['UVEVirtualNetwork']['attached_policies'][0][0])
self.assertEqual(
sorted(["10.10.10.10", "10.10.10.11"]),
sorted(res['UVEVirtualNetwork']['attached_policies'][0][1:]))
acl1 = uvevn["abc-corp:vn-00"]['UVEVirtualNetwork'][
'total_acl_rules']["10.10.10.10"]
acl2 = uvevn2["abc-corp:vn-00"]['UVEVirtualNetwork'][
'total_acl_rules']["10.10.10.11"]
self.assertEqual(
sorted([acl1, acl2]),
sorted([res['UVEVirtualNetwork']['total_acl_rules'][0][0],
res['UVEVirtualNetwork']['total_acl_rules'][1][0]]))
self.assertEqual(
sorted(["10.10.10.10", "10.10.10.11"]),
sorted([res['UVEVirtualNetwork']['total_acl_rules'][0][1],
res['UVEVirtualNetwork']['total_acl_rules'][1][1]]))
logging.info(json.dumps(res, indent=4, sort_keys=True))