<reponame>JIAQING-XIE/Computer-Communications-and-Networks
import pytest
from scapy.utils import RawPcapReader
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP
from ipaddress import ip_address, ip_network
from pcap_aggr import Data, Node
from ipaddress import ip_network

testfile1 = '202011251400-78-5k.pcap'
testdata_aggr = {'0.0.0.0/2': 141232, '172.16.17.32/6': 368983, '0.0.0.0/0': 94144, '192.168.127.12/3': 1633302, '192.168.127.12/1': 137206, '172.16.31.10/32': 224411}

def test_pcap_aggr2():
    data = Data(testfile1)
    for k, v in testdata_aggr.items():
        assert data.data[ip_network(k)] == v


import pytest
from scapy.utils import RawPcapReader
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP
from ipaddress import ip_address, ip_network
from pcap_aggr import Data, Node
from ipaddress import ip_network

testfile1 = '202011251400-78-5k.pcap'
testdata_aggr = {'0.0.0.0/2': 141232, '172.16.17.32/6': 368983, '0.0.0.0/0': 94144, '192.168.127.12/3': 1633302, '192.168.127.12/1': 137206, '172.16.31.10/32': 224411}

def test_pcap_aggr2():
    data = Data(testfile1)
    for k, v in testdata_aggr.items():
        assert data.data[ip_network(k)] == v