def build_autonomous_systems(self): print('Processing data:', end='') data = self.filename.get_data() for line in data: if IPv4Prefix.get_count() % 10000 == 0: print('.', end='') sys.stdout.flush() prefix = self.create_prefix(line) asn = prefix.destination_asn next_hop = prefix.next_hop_asn if asn not in AutonomousSystem.dict_of_all: self.create_new_asn(asn).ipv4_prefixes.append(prefix) else: self.find_asn(asn).ipv4_prefixes.append(prefix) if next_hop: if next_hop not in AutonomousSystem.dict_of_all: self.create_new_asn(next_hop).ipv4_next_hop_prefixes.append(prefix) else: self.find_asn(next_hop).ipv4_next_hop_prefixes.append(prefix) else: pass
def print_stats(self): print() print('IPv4 Routing Table Size:', IPv4Prefix.get_count()) print('Unique ASNs:', len(AutonomousSystem.dict_of_all)) print('Peer Networks:', len(self.list_of_peers()))