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'])
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'])
def test_append_agg(self): logging.info("%%% 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) 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", "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'])
def test_append_agg(self): logging.info("%%% 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) 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", "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'])
def setUp(self): self._oss = UVEServer(None, None)