3

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.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108

2 Answers2

4

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
Anamort
  • 341
  • 4
  • 17
1

To log the flows which gets flushed, you can use OFPFF_SEND_FLOW_REM field available, which can be set by controller while setting up the flow action. According to openflow-specification:

When a flow entry is removed, either by the controller or the flow expiry mechanism, the switch must check the flow entry’s OFPFF_SEND_FLOW_REM flag. If this flag is set, the switch must send a flow removed message to the controller. Each flow removed message contains a complete description of the flow entry, the reason for removal (expiry or delete), the flow entry duration at the time of removal, and the flow statistics at the time of removal.

I am not sure about the exact implementation in POX, but this when combined with ovs-ofctl dump-flows may be a good approach

Suraj jha
  • 86
  • 4