|
@@ -2,10 +2,14 @@ import unittest
|
|
import random
|
|
import random
|
|
|
|
|
|
import ID2TLib.TestLibrary as Lib
|
|
import ID2TLib.TestLibrary as Lib
|
|
|
|
+import ID2TLib.Utility as Util
|
|
import Core.Controller as Ctrl
|
|
import Core.Controller as Ctrl
|
|
|
|
|
|
controller = Ctrl.Controller(pcap_file_path=Lib.test_pcap, do_extra_tests=False, non_verbose=True)
|
|
controller = Ctrl.Controller(pcap_file_path=Lib.test_pcap, do_extra_tests=False, non_verbose=True)
|
|
controller.load_pcap_statistics(flag_write_file=False, flag_recalculate_stats=True, flag_print_statistics=False)
|
|
controller.load_pcap_statistics(flag_write_file=False, flag_recalculate_stats=True, flag_print_statistics=False)
|
|
|
|
+controller_synth = Ctrl.Controller(pcap_file_path=Util.TEST_DIR + "synth_ttl_mss.pcap", do_extra_tests=False,
|
|
|
|
+ non_verbose=True)
|
|
|
|
+controller_synth.load_pcap_statistics(flag_write_file=False, flag_recalculate_stats=True, flag_print_statistics=False)
|
|
|
|
|
|
ipAddresses = ['10.0.2.15', '104.83.103.45', '13.107.21.200', '131.253.61.100', '172.217.23.142', '172.217.23.174',
|
|
ipAddresses = ['10.0.2.15', '104.83.103.45', '13.107.21.200', '131.253.61.100', '172.217.23.142', '172.217.23.174',
|
|
'192.168.33.254', '204.79.197.200', '23.51.123.27', '35.161.3.50', '52.11.17.245', '52.34.37.177',
|
|
'192.168.33.254', '204.79.197.200', '23.51.123.27', '35.161.3.50', '52.11.17.245', '52.34.37.177',
|
|
@@ -81,9 +85,18 @@ class UnitTestInternalQueries(unittest.TestCase):
|
|
def test_get_most_used_mss(self):
|
|
def test_get_most_used_mss(self):
|
|
self.assertEqual(controller.statistics.get_most_used_mss(ip_address='10.0.2.15'), 1460)
|
|
self.assertEqual(controller.statistics.get_most_used_mss(ip_address='10.0.2.15'), 1460)
|
|
|
|
|
|
|
|
+ def test_get_most_used_mss_multiple(self):
|
|
|
|
+ self.assertEqual(controller_synth.statistics.get_most_used_mss(ip_address='72.247.178.67'), 1200)
|
|
|
|
+
|
|
|
|
+ def test_get_most_used_mss_none(self):
|
|
|
|
+ self.assertEqual(controller_synth.statistics.get_most_used_mss(ip_address='2.2.2.2'), None)
|
|
|
|
+
|
|
def test_get_most_used_ttl(self):
|
|
def test_get_most_used_ttl(self):
|
|
self.assertEqual(controller.statistics.get_most_used_ttl(ip_address='10.0.2.15'), 128)
|
|
self.assertEqual(controller.statistics.get_most_used_ttl(ip_address='10.0.2.15'), 128)
|
|
|
|
|
|
|
|
+ def test_get_most_used_ttl_multiple(self):
|
|
|
|
+ self.assertEqual(controller_synth.statistics.get_most_used_ttl(ip_address='72.247.178.67'), 48)
|
|
|
|
+
|
|
def test_get_pps_sent_1(self):
|
|
def test_get_pps_sent_1(self):
|
|
self.assertEqual(controller.statistics.get_pps_sent(ip_address='72.247.178.67'), 0)
|
|
self.assertEqual(controller.statistics.get_pps_sent(ip_address='72.247.178.67'), 0)
|
|
|
|
|