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


Python uveserver.ParallelAggregator类代码示例

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


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

示例1: test_sum_agg

    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'])
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:27,代码来源:test_uveserver.py

示例2: test_counter_agg

    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'])
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:30,代码来源:test_uveserver.py

示例3: test_list_union_agg

    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'])
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:33,代码来源:test_uveserver.py

示例4: test_map_union_agg

    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']))
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:28,代码来源:test_uveserver.py

示例5: test_union_agg

    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"])
开发者ID:npchandran,项目名称:contrail-controller,代码行数:26,代码来源:uveserver_test.py

示例6: test_append_agg

    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'])
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:34,代码来源:test_uveserver.py

示例7: test_struct_sum_agg

    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'])
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:27,代码来源:test_uveserver.py

示例8: test_simple

    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))
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:13,代码来源:test_uveserver.py

示例9: test_sum_agg

    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"])
开发者ID:npchandran,项目名称:contrail-controller,代码行数:16,代码来源:uveserver_test.py

示例10: test_append_agg

    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'])
开发者ID:Doude,项目名称:contrail-controller,代码行数:44,代码来源:uveserver_test.py

示例11: test_default_agg

    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)
开发者ID:npchandran,项目名称:contrail-controller,代码行数:43,代码来源:uveserver_test.py

示例12: test_href_agg

    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"])
开发者ID:chihchum,项目名称:contrail-controller,代码行数:19,代码来源:uveserver_test.py

示例13: test_default_agg

    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))
开发者ID:dsundarraj,项目名称:contrail-controller,代码行数:42,代码来源:test_uveserver.py


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