|
3 | 3 | import subprocess |
4 | 4 | import time |
5 | 5 |
|
| 6 | +import dpkt |
| 7 | + |
6 | 8 | from ipmininet.ipnet import IPNet |
7 | 9 | from jobs import Jobs |
8 | 10 | from network_schema import Job, Network |
@@ -180,6 +182,22 @@ def create_animation( |
180 | 182 | if not os.path.exists(pcap_out_file2): |
181 | 183 | raise ValueError("No capture for interface: " + link2) |
182 | 184 |
|
| 185 | + # Log pcap sizes and packet counts before parsing |
| 186 | + for fname, iface, node_name in [ |
| 187 | + (pcap_out_file1, link1, edge_source), |
| 188 | + (pcap_out_file2, link2, edge_target), |
| 189 | + ]: |
| 190 | + fsize = os.path.getsize(fname) |
| 191 | + try: |
| 192 | + with open(fname, "rb") as _f: |
| 193 | + _count = sum(1 for _ in dpkt.pcapng.Reader(_f)) |
| 194 | + except Exception as _e: |
| 195 | + _count = -1 |
| 196 | + info( |
| 197 | + "[create_animation] pcap: node=%s iface=%s file=%s size=%d pkt_count=%d\n" |
| 198 | + % (node_name, iface, fname, fsize, _count) |
| 199 | + ) |
| 200 | + |
183 | 201 | with open(pcap_file1, "rb") as file1, open(pcap_file2, "rb") as file2: |
184 | 202 | pcap_list.append((file1.read(), link1)) |
185 | 203 | pcap_list.append((file2.read(), link2)) |
|
0 commit comments