Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log all flow table entries periodically in mininet by Python code?

In my understanding, dpctl dump-flows command only helps to view current state of flow table. Flow table gets flushed often. I want to record the flow table entries.

Which class do I need to look into to record flow table? I am using POX controller and mininet on Ubuntu installed in Virtual Box.

like image 552
Sangeetha Sangeetha Avatar asked Apr 28 '26 07:04

Sangeetha Sangeetha


1 Answers

Considering s2 as a switch, you can record flow tables using this (-O OpenFlow13 is optional):

sh ovs-ofctl dump-flows s2 -O OpenFlow13 > exampleLog.txt

If you have rules in s2, the results would be:

mininet@mininet-vm:~/mininet$ cat exampleLog.txt
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0x170000000000000, duration=9.458s, table=0, n_packets=6, n_bytes=588, priority=10,ip,in_port=1,nw_src=10.0.0.1,nw_dst=10.0.0.6 actions=output:4
 cookie=0x170000001000000, duration=8.556s, table=0, n_packets=5, n_bytes=490, priority=10,ip,in_port=4,nw_src=10.0.0.6,nw_dst=10.0.0.1 actions=output:1
 cookie=0x0, duration=42.627s, table=0, n_packets=20, n_bytes=1368, priority=0 actions=CONTROLLER:65535
like image 149
Anamort Avatar answered Apr 29 '26 21:04

Anamort



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!